Is there any difference between range() and xrange() methods in Python 2.x?
In Python 2.x range() method returns a whole list of numbers while xrange() returns a generator. Later this generator can be used to get numbers one by one in a so-called lazy evaluation manner. In Python 3 described range() method was deprecated and xrange() method was renamed to range().

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback
Keep exploring
Python quizzes
Sign Up Now
or Subscribe for future quizzes