8.02
Completed
Repeating with range() Repeating with range()

Learn to repeat code, generate number sequences, and count forward or backward with Python's range().

Repeating with range()

Sounds useful?

Jump into the interactive version.

No setup. No account. Just Python.

Interactive Python lesson

Repeating with range()

This Block shows you how to combine Python’s for loops with range() for controlled repetition. You will generate number sequences, repeat actions a fixed number of times, choose starting and stopping points, change the step size, and create countdowns.

What you will learn:

  • Repeat code with range(stop)
  • Choose boundaries with range(start, stop)
  • Control jumps with range(start, stop, step)
  • Count backward using a negative step
  • Remember why the stopping number is never included
  • Choose between looping through existing items and generating numbers with range()

Leave with a clear mental model for reading ranges, avoiding off-by-one mistakes, and letting Python handle repetitive work for you.

> Start now 144 cards · about 10 min

Ready to practice this in the browser?

> Play now