Turtle graphics is a playful way to see what code does. A little pen moves around the screen as your instructions run, leaving a drawing behind.
Moving the turtle
Basic commands include moving forward, turning left or right, and lifting the pen. For example, moving forward 100 and turning 90 degrees four times draws a square.
Where loops come in
Writing the same two lines four times is tiring. A loop does it neatly:
for i in range(4):
forward(100)
left(90)
Change 4 to 5 and the angle to 72, and you get a pentagon. The learner sees the connection between numbers and shapes right away.
Experiment with patterns
- Change the angle and the number of repeats to make stars and spirals.
- Use different colors and line thickness.
- Put a drawing inside another loop to make a flower made of circles.
Why it is a good learning tool
The result is visual and immediate. Mistakes are easy to spot, because the drawing looks wrong, and fixing them teaches careful thinking.
For parents and mentors
Ask the learner to predict the shape before running the code. Then compare. Discuss what would change if one number were different.
A note on tools
Turtle needs a browser editor or environment that supports it. If one tool does not, try another current Python editor that does.
Takeaway
Drawing with code makes loops and angles concrete, and the finished picture is a nice reward.
Continue with the book
Explore the full treatment, worked examples, and exercises in Code Quest with Python.
Adapted from Code Quest with Python, published by Choral Software. Article text and original examples © 2026 Choral Software. All rights reserved.
