Learning goals
- Explain what a turtle’s heading is.
- Point the turtle in a chosen direction with
setheading().- Compare
setheading()withleft()andright().
A heading is the direction the turtle faces. The turtle starts facing right, at 0 degrees.
You already know how to turn with left() and right().
Those commands turn from the direction the turtle faces now.
setheading() work?Use setheading(angle) to point the turtle in a chosen direction.
It changes the turtle’s direction but does not move it.
import turtle as otto
otto.setheading(90)
otto.forward(60)

The turtle points up, then draws a line 60 units long.
The angle tells the turtle which way to face:
| Angle | Direction |
|---|---|
0 |
Right |
90 |
Up |
180 |
Left |
270 |
Down |
The angles grow counterclockwise.
A negative angle goes the other way, clockwise.
So setheading(-90) points down, just like setheading(270).
This picture shows the direction for each angle.

setheading() different from left()?left() turns from the current direction.
setheading() points in the same chosen direction every time.
Try it yourself: Predict which way the turtle will draw. Then click Run to check.
import turtle as otto otto.left(90) otto.setheading(0) otto.forward(60)

First, left(90) points the turtle up.
Then, setheading(0) points it right.
The turtle draws a line to the right.
| Command | What it does |
|---|---|
otto.setheading(0) |
Points the turtle right. |
otto.setheading(90) |
Points the turtle up. |
otto.setheading(180) |
Points the turtle left. |
otto.setheading(270) |
Points the turtle down. |
otto.left(angle) |
Turns left from the current direction. |
otto.right(angle) |
Turns right from the current direction. |