Range Function

range()

Accepts up to 3 integer arguments.

First two arguments define the range while the 3rd argument defines the step interval.

Integers can be both positve and negative.

Examples #

>>> for i in range(12, 16):
...     print(i)
...
12
13
14
15
>>> for i in range(0, 10, 2):
...     print(i)
...
0
2
4
6
8

A negative step-interval counts backwards.

>>> for i in range(5, -1, -1):
...     print(i)
...
5
4
3
2
1
0