range()
range() generates a sequence of integers, most often used with a for loop
Understanding range() in Python
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 class and your students practise it interactively.
This module's key terms are also in a printable crossword (Modules 21–30) and word search (Modules 21–40).
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
Student with a class code? Join your class →