Monday, November 26, 2012

Turtle

Turtle is a Python module to draw pictures.
import turtle # allows us to use the turtles library
wn = turtle.Screen() # creates a graphics window
alex = turtle.Turtle() # create a turtle named alex
alex.forward(150) # tell alex to move forward by 150 units
alex.left(90) # turn by 90 degrees
alex.forward(75) # complete the second side of a rectangle
wn.exitonclick()

No comments:

Post a Comment