What is the difference between range & xrange?
Dinesh Beniwal
Select an image from your device to upload
Thanks for publishing such good questions. I also came across a platform which is also good .
I think this is a really clear explanation of the difference between range() and xrange(), especially the part about lazy evaluation and memory usage. I remember being confused about why xrange() existed in older Python versions until I learned how much more efficient it could be for large loops. Learning programming concepts like this always makes me appreciate how many systems run behind the scenes in games and platforms, including fun projects like EaglerCraft Game.
range()
xrange()
In Python 3, the original range function has been removed and renamed xrange to range.
range function returns a list of numbers created using range()