from turtle import * sizes = [20, 40, 60, 80, 100] # list for size in sizes: # outer loop, different square sizes from list def square(): # function definition for x in range(0,4): # inner loop creating a square forward(size) # size doesn't change until the outer loop is executed right(90) # right turn 90 degrees # this code block for the outer loop (below) has to be # precisely indented in line with the def square(): function definition, # otherwise it won't run properly pendown() # same starting point for each square color('blue') square() # first calling and drawing of a square side from the inner loop, # then drawing a different square size from the "for loop" outer loop penup() input() # pause the turtle display screen to see the drawing