range()
noun
say it: “RAYNJ” /reɪndʒ/
A built-in Python function that makes a series of whole numbers, stopping before the end number, most often to repeat something a set number of times.
What does range() do?
range() makes a series of numbers, most often to repeat something a set number of times. It stops before the end number.
for lap in range(1, 4):
print("Lap", lap) # Lap 1, Lap 2, Lap 3
In a sentence
- “for lap in range(1, 4) prints Lap 1, Lap 2 and Lap 3.”
- “range() with a step of 2 counted the even seat numbers.”
Level: Apprentice · More Python terms at this level
Updated