Control Flow: The for Loops

Additional Practice

Draw the tilted squares using for loops.

Use turtle goto() function to draw circles and squares at other (random) locations onthe screen. Remember the penup() and pendown() functions. Do not move too far out on the drawing board, your turtle might get lost if you use relative positioning with respect to your last position. Instead you might prefer absolute positioning, i.e. with respect to the origin (0, 0).

You can use the following code to select random colors for your shapes, try it out for randomly generated shapes in a for loop.

turtle.colormode(255)

red = random.randint(0, 255)
green = random.randint(0, 255)
blue = random.randint(0, 255)

turtle.pencolor(red, green, blue)