Junior Codes
Clockwork Woods

Python range() for Kids: Start, Stop and Step

Count from any number, to any number, in any size of step.

Start Wonderwild free with Pip

Try 5 starter activities free. Full access is ₹499 a year.

This mission is part of full access. The first missions are free to try.

range(), explained simply

range(5) gives 0, 1, 2, 3, 4. But range can do much more if you give it extra numbers.

With two numbers, range(start, stop) begins at start and stops just before stop. With three, range(start, stop, step) jumps by step each time. The stop number itself is never included.

A negative step counts backwards, so range(10, 0, -2) gives 10, 8, 6, 4, 2.

Example: Hop across the stones

for stone in range(2, 11, 2):
    print("Hop to stone", stone)

Output

Hop to stone 2
Hop to stone 4
Hop to stone 6
Hop to stone 8
Hop to stone 10

Try this

  • Print the five times table using range with a step of 5.
  • Count down from 10 to 1 using a negative step.
  • Predict what range(3, 3) gives, then test it.

Practise it in Wonderwild

“Stepping-stone rhythm”

Mission 15 in Clockwork Woods, one of 36 Python missions in Wonderwild.

Your child writes and runs real Python in the browser while Pip reacts to every line. Nothing to install. For ages 7+.

Start Wonderwild free with Pip

Try 5 starter activities free. Full access is ₹499 a year.

This mission is part of full access. The first missions are free to try.

Questions parents and kids ask

Why is the stop number not included in range()?+

It makes counting tidy: range(0, 5) gives exactly five numbers, and range(5, 10) carries on right where it finished. You get used to it quickly.

Can range() count in decimals?+

No, range only works with whole numbers. For decimals you can loop over whole numbers and divide, for example i / 10.

Prefer learning with a teacher?

Our live Python for Young Developers course teaches these ideas in small online classes led by a software engineer, with projects and feedback. Every live course also includes 12 months of full Wonderwild access for practice.

See the Python for Young Developers course