Turtles
import turtle # allows us to use the turtles library/module
window = turtle.Screen() # creates a graphics window
alex = turtle.Turtle() # create a turtle named alex
alex.forward(150) # tell the object alex to move forward by 150 units invoking .forward method
alex.left(90) # turn by 90 degrees
alex.forward(75) # complete the second side of a rectanglealex = turtle.Turtle()import turtle
window = turtle.Screen()
window.bgcolor("lightgreen") # property
tess = turtle.Turtle()
tess.color("blue") # property
tess.pensize(3) # property
tess.forward(50) # method
tess.left(120) # method
tess.forward(50) # method
window.exitonclick() # methodInstances
For Loop

Iteration simplifies programs
range function
range functionTurtle specific methods
Modules
The math and random modules
math and random modulesLast updated
Was this helpful?