Does range function allows concatenation ? Like i want to make a range(30) & concatenate it with range(2000, 5002). So my concatenated range w
range() in Python 2.x returns a list:
>>> range(10)
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
xrange() in Python 2.x returns an iterator:
>>> xrange(10)
xrange(10)
And in Python 3 range() also returns an iterator:
>>> r = range(10)
>>> iterator = r.__iter__()
>>> iterator.__next__()
0
>>> iterator.__next__()
1
>>> iterator.__next__()
2
So it is clear that you can not concatenate iterators other by using chain() as the other guy pointed out.