22 lines
284 B
Markdown
22 lines
284 B
Markdown
|
---
|
||
|
title: Range Method
|
||
|
---
|
||
|
# Range Function
|
||
|
If you do need to iterate over a sequence of numbers, the built-in function range() comes in handy. It generates arithmetic progressions:
|
||
|
|
||
|
#### Example Usage
|
||
|
```py
|
||
|
for i in range(5):
|
||
|
print(i)
|
||
|
```
|
||
|
|
||
|
#### Output
|
||
|
```
|
||
|
0
|
||
|
1
|
||
|
2
|
||
|
3
|
||
|
4
|
||
|
```
|
||
|
|