range()
range() generates a sequence of integers, most often used with a for loop
What it does: range(start, stop, step) — starts at 2, counts by 2, stops before 8. Step of 2, stopping before 10 — so 10 is excluded. Stop is 0, which is excluded — count down stops at 1. range(1, 4) gives 1, 2, 3 — that's 3 numbers. Start at 1, add 3 each time: 1, 4, 7, then 10 is excluded. range() only accepts integer arguments. Using floats causes a TypeError. list() converts a range to a list. range(3) gives 0, 1, 2. Creates numbers from 0 up to but not including stop.
Common mistakes: range(1, 5) stops before 5: use range(1, 6) to include 5. To count down, you need a negative step: range(10, 0, -1).
Free printable worksheet with full answer key — or add this module to a journey and assign it to your class.
Take this worksheet further — free with Cloodit
Each concept is reinforced from every angle — learned, then applied, then tested.
Cloodit turns curriculum-aligned coding content into journeys students work through one biome at a time.
Over 100 of them, across seven natural biomes.
Turns their work into revision material ready for Flash Cards and Exam study.
Live, competitive practice for the start of the lesson or a teacher-led lesson finisher.
Honour your top performers, or encourage a student who's trying hard — ready to print in seconds.
Quick Questions
Match the Pairs
Key Term
range(stop)Fill in the Blanks
Spot the Error
Create a free class, add this module to a journey, and track who's stuck.
Create a free teacher account →No credit card. No setup fee. Make a class and invite students in under three minutes.
Practice this topic interactively, track progress, and unlock badges.
Start Learning Free →