Python xrange Function

Python xrange() function is similar to range function. However, xrange() do not generate the list, while loop through an arithmetic progression, thus memory efficient.

>>> for x in xrange(1,1000000): print(x)

is better than:
>>> for x in range(1,1000000): print(x)

Note: xrange is no longer supported in Python 3.