#------------------------------------------------------------------------------- # TurtleFunction2.py #------------------------------------------------------------------------------- import turtle def draw_multicolor_square(t, sz): """Make turtle t draw a multi-color square of size sz.""" for i in ["red", "purple", "hotpink", "blue"]: t.color(i) t.forward(sz) t.left(90) # end for # end of draw_multicolor_square() #-- main program -------------------------------------------------------------- wn = turtle.Screen() # Set up the window and its attributes wn.bgcolor("lightgreen") tess = turtle.Turtle() # Create tess and set some attributes tess.pensize(3) # tess.speed(0) # uncomment and try different speeds in range 0-10 size = 20 # Size of the smallest square for i in range(20): draw_multicolor_square(tess, size) size += 10 # Increase the size for next time tess.forward(10) # Move tess along a little tess.right(18) # and give her some extra turn wn.mainloop()