Shapes and the Angle Rule
Last time you steered the turtle around and even drew a square, turning 90 at each corner. But why 90? And how would you draw a triangle, where the corners look different? Today you’ll learn the one rule behind every shape.
Degrees: how much to turn
The number in t.right(90) is measured in degrees. Here’s the only fact you need: a full spin, all the way around back to where you started facing, is 360 degrees.
90is a quarter of a full spin — a square corner.180is a half spin — now you face the opposite way.360is a whole spin — right back where you started.
Run this to feel a full spin (the turtle turns a little and walks, four times, ending facing its start):
Four turns of 90 add up to 360 — a full spin. That’s why a square closes perfectly.
The angle rule
Here’s the magic rule for any shape with equal sides:
Turn = 360 ÷ number of sides.
- Triangle: 3 sides → 360 ÷ 3 = 120
- Square: 4 sides → 360 ÷ 4 = 90
- Pentagon: 5 sides → 360 ÷ 5 = 72
- Hexagon: 6 sides → 360 ÷ 6 = 60
Let’s test it on a triangle — 3 sides, turning 120:
Three sides, three turns of 120. A perfect triangle!
Try it 🎯
- Change all three
right(120)toright(90). Does the triangle still close? (Nope — wrong angle for 3 sides.) - Put it back to
120. Change theforward(120)toforward(180). Bigger triangle, same shape.
Predict it 🔮
Using the rule: to draw a pentagon (5 sides), what angle should you turn? Work it out (360 ÷ 5), then fill it into the code below and Run to check. A pentagon needs 5 forwards and 5 turns:
(The answer was 72. Five turns of 72 = 360 — a full spin, so it closes.)
Fix the bug 🐞
This is meant to be a hexagon (6 sides), but whoever wrote it used the wrong angle, so it doesn’t close. Use the rule (360 ÷ 6) and fix all the turns:
(Each right(90) should be right(60). A hexagon has 6 sides, and 360 ÷ 6 = 60.)
Your mission 🚀
Draw an octagon — an 8-sided shape (like a stop sign). First, figure out the angle with the rule: 360 ÷ 8 = ? Then finish the shape below (it has 3 sides so far; you need 8 total):
What you learned today
- A turn is measured in degrees, and a full spin is 360.
- The angle rule: turn = 360 ÷ number of sides.
- With that one rule you can draw a triangle, pentagon, hexagon, octagon — any equal-sided shape.
Did you notice how much typing a hexagon took — the same two lines, over and over? Hold that thought. In a few lessons, a tool called a loop will draw any of these in just two lines. First, though, let’s add color. 🐢
Comments