Ranges
rangeis a data type that offers an iterable sequence of integers
To create a range, you can use 1 to 3 arguments:
range(stop): integer sequence will go from0tostop - 1- Example:
list(range(4))is[0,1,2,3]
- Example:
range(start,stop): integer sequence will go fromstarttostop - 1- Example:
list(range(3, 7))is[3,4,5,6]
- Example:
range(start,stop, step): integer sequence will go fromstarttostopsummingstepat each stage- Example:
list(range(1,10,3))is[1,4,7]
- Example: