Name | range() |
||||||
---|---|---|---|---|---|---|---|
Examples |
for i in range(5): print(range(i)) ''' The above prints: [] [0] [0, 1] [0, 1, 2] [0, 1, 2, 3] ''' | ||||||
Description | Range() generates lists containing arithmetic progressions. It is useful when you need to iterate over a sequence of numbers. The end point is never part of the generated list, i.e. the list generate by range(5) will not include 5. It is possible to let range start at another number, or to specify another increment. | ||||||
Syntax | range(end) range(start, end) range(start, end, increment) | ||||||
Parameters |
|
Updated on Tue Feb 27 14:07:12 2024.
If you see any errors or have comments, please let us know.
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License