"""File: draw_polygon.py Purpose: Draw a regular polygon (i.e., all sides have same length) Run: draw_polygon Input: n = number of sides length = sidelength Output: Regular polygon drawn from current position of turtle """ from TurtleWorld import * def draw_polygon(t, length, n): """Draw a regular polygon with n sides and sidelength length using turtle t """ degrees = 360.0/n for i in range(n): fd(t, length) lt(t, degrees) # Program start here world = TurtleWorld() # Create an instance of TurtleWorld -- i.e, a window bob = Turtle() # Create an instance of a Turtle n = int(raw_input("How many sides does the polygon have?\n ")) length = int(raw_input("How long is each side?\n ")) draw_polygon(bob, length, n) wait_for_user()