A range represents a sequence of integer, it is not a list or a set.
To get a list of a set from a range, you have to use the constructor: list() or set().
>>> list(range(2))
[0, 1]
For any integer n, range(n) represents the sequence of integers from 0 through n - 1.
for x in range(5):
print x
0
1
2
3
4
A range can take 1, 2 or 3 arguments.
You can form a range with one, two, or three arguments.
Range starts the range at zero and increments by 1 until the size reaches 1 less than the range.
For instance:
print range(1)
[0]
print range(2)
[0,1]
Range starts the range at the first argument and increments by 1 until the size reaches 1 less than the second argument:
range(1,3)
[1,2]
print range(2,5)
[2, 3, 4]
range(Start,End,Increment)
where:
For instance:
print range(4,13,2)
[4, 6, 8, 10, 12]