Drawing your first shapes Jump to this section
This lesson shows how to draw simple shapes with Turtle: squares, rectangles, triangles, and circles. You'll learn the order of commands, how to reuse code with loops, and how to move the turtle without drawing.
Basic movement Jump to this section
forward(distance)(orfd) — move forward and draw a line.backward(distance)(orbk) — move backward.left(angle)/right(angle)— turn the turtle.
Example: move and turn step-by-step
import turtle
t = turtle.Turtle()
t.forward(50)
t.left(90)
t.forward(50)
t.right(90)
t.backward(50)
From now on, the examples won't include
Screen()orturtle.done(), but make sure to include these if running the code on your own computer.
Draw a square Jump to this section
Here is a square written out step-by-step. Each left(90) turns the turtle a quarter turn.
import turtle
t = turtle.Turtle()
t.forward(100)
t.left(90)
t.forward(100)
t.left(90)
t.forward(100)
t.left(90)
t.forward(100)
Rectangle and triangle Jump to this section
Rectangle (two long sides, two short sides):
import turtle
t = turtle.Turtle()
t.forward(150)
t.left(90)
t.forward(80)
t.left(90)
t.forward(150)
t.left(90)
t.forward(80)
Equilateral triangle (each angle 120°):
import turtle
t = turtle.Turtle()
for _ in range(3):
t.forward(140)
t.left(120)
Circle and arc Jump to this section
You can draw circles with circle(radius).
import turtle
t = turtle.Turtle()
t.circle(60) # radius 60
Smaller radius makes a smaller circle; negative radius draws the circle to the other side.
