Hi, i want to know What is the difference between range & xrange
Normally xrange and range are the same in terms of functionality. Both of them allow us to create a list of integers. The only difference is that xrange returns an “xrange object” while range returns “Python list object”.
It means, range creates a static value while xrange does not.
If you are working with a memory sensitive system like a mobile phone range will use as much memory as it can to generate an array of integers that may cause a system failure.
Please let me know if it helps.
3 Likes