Python for Loops and range() for Kids
A for loop runs the same instruction several times, so a child writes one line instead of twenty.
- 15 exercises
- 5 lessons
- Ages 10+
- PRO
This topic is part of PRO — a one-time $49.99 purchase, no subscription. Topics 1–3 are free, start to finish, and the first level needs no account.
For parents & teachers
What this topic covers
The appeal of a loop is immediate — one instruction, repeated — and children take to it quickly. The difficulty is not the loop, it is range(). range(5) produces five numbers starting at 0 and never reaches 5, which is surprising to everyone the first time and is the source of nearly every off-by-one error a beginner writes.
This topic gives range() a segment of its own rather than mentioning it in passing. Children predict what a range will produce before running it, and see the difference between how many times a loop runs and what the numbers inside it actually are.
The last idea is accumulation: carrying a value forward from one pass to the next to build up a total. It combines loops with the variable-updating from the previous topic, and it is the first genuinely powerful thing a child can write here.
Built around a real misconception
The mistake this topic is built to fix
A child expects range(5) to count 1, 2, 3, 4, 5.
Why the topic is built around it
It produces 0, 1, 2, 3, 4 — five numbers, but not the five expected. Off-by-one errors from this are so common that the topic devotes a whole segment to predicting range output before writing any loop that depends on it.
for i in range(3): print("Roar", i)
Explain · Ask · Guided · Practice
The lessons, in order
Each lesson explains one idea in short steps, checks it landed with a question, walks through a guided first try, then leaves the child to practise on their own.
for and range() — one instruction, run again and again.
- Explain
- Ask
- Guided 1 level
- Practice 2 levels
range(n) gives n numbers starting at 0 — and never reaches n itself.
- Explain
- Ask
- Guided 1 level
- Practice 2 levels
Carrying a value forward, loop pass after loop pass.
- Explain
- Ask
- Guided 1 level
- Practice 2 levels
Lesson 4: The Dragon Patrol
Topic challengeLoops, counting, and decisions — all working together, pass after pass.
- Explain
- Ask
- Guided 1 level
- Challenge 2 levels
A loop inside a loop, for checking every cell of a grid — and the order that surprises everyone.
- Explain
- Ask
- Guided 1 level
- Practice 2 levels
Lessons unlock in order within a topic, so nothing arrives before the idea it depends on. This topic is part of PRO — $49.99 unlocks it along with everything else.
Try it now
The very first level needs no account at all — see whether it clicks before signing up for anything.
Play the first level free