Dinesh Beniwal
What is the difference between range & xrange?
By Dinesh Beniwal in Python on Jun 24 2019
  • Rupesh Kahane
    Jul, 2019 9

    range() – This returns a list of numbers created using range() function. xrange() – This function returns the generator object that can be used to display numbers only by looping. Only particular range is displayed on demand and hence called “lazy evaluation“.Both are implemented in different ways and have different characteristics associated with them. The points of comparisons are: - Return Type - Memory - Operation Usage - Speedrange() returns – the list as return type. xrange() returns – xrange() object.

    • 1
  • Arvind Singh Baghel
    Jul, 2019 19

    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()

    • 0


Most Popular Job Functions


MOST LIKED QUESTIONS