0
What exactly differences between range and xrange?
3 Respostas
+ 2
range() and xrange() are two functions that could be used to iterate a certain number of times in for loop.
Functionality wise both are same.
In Python- 3, there is no xrange , but the range function behaves like xrange in Python -2.
Return type:
range() returns – the list as return type.
xrange() returns – xrange() object
range() returns – the list as return type.
xrange() returns – xrange() object
0
Both range() and xrange() are built-in functions in Python that are used to generate integers or whole numbers in a given range . The range() and xrange() comparison is relevant only if you are using both Python 2.x and Python 3 . It is because the range() function in python 3.x is just a re-implementation of the xrange() of python 2.x. It actually works the same way as the xrange does. More...http://net-informations.com/python/pro/xrange.htm