Lesson 11: Drawing with Turtle: Shapes, Colors, and Loops You Can See

This drawing is a simulation of Turtle — run the same code in IDLE to see the real thing. The loop below is the lesson’s loop: once per side, go forward, then turn. The drawing is scaled and centred only so the shape fits this canvas.

In the lesson, a square is 4 sides with 90-degree turns, and a triangle is 3 sides with 120-degree turns. Here the turn is always 360 divided by the number of sides, so any number of sides closes neatly into a shape.


Try this: Change the sides to 3 and press Run again — the square becomes a triangle, with 120-degree turns.

The code (run this same loop in IDLE for the real Turtle drawing)



What the turtle does

Press Run to draw.