Python TutorialLesson 23Free preview
Python Range
This lesson is part of Python · All levels
Summary
The range function produces a sequence of numbers that is very useful as a control of repetition. We can determine the starting value, the end limit, even the big jump between numbers. However, the range is not a list but a number-generating object, so it is memory-saving and often used in conjunction with the for.
Key points
- Range(n) produces numbers from 0 to n - 1.
- Start at the beginning and stop before the end.
- The third argument is a jump between numbers.
- The range is common, meaning the elements are generated when needed.
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.