I am trying to create a random triangle in python turtle with a for loop. I figured it out how to complete the task without a for loop, but I was instructed to use a for loop. I am going to add my code that isn’t working. I need explanations and examples if that is possible. I what to understand . range is (-r,r) and the starts at the origin. Thank you:

import turtle import random turtle.penup() turtle.color(‘red’) def median®: L = [] for i in range (3): L.append(randint(-r,r),randint(-r,r)) forward® return L turtle.pendown()

Submit an answer

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!