Differentiate between range and xrange.

Answer Posted / hr@tgksolutions.com

Functionality-wise, xrange and range are nearly identical. Both of these let you create an integer list that you may use however you like. The only distinction between xrange and range is that x range returns an xrange object, whereas range returns a Python list object. Range will use as much memory as possible to produce your array of numbers, which can result in a memory error and crash your program. This is particularly true if you are working with a device that needs a lot of memory, like a phone. It has a memory issue and is a beast.

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How does python input work?

615


What is python programming language?

600


What happened if we call a key that is not present in dictionary and how to tackle that kind of error ?

582


What is tuple in python?

613


What does join () do in python?

578






What is sockets? Explain.

654


Can a constructor be static?

538


What are advantages of a tuple over a list?

578


How is python used in the real world?

605


Why python is the best?

573


Explain about multi-threading concept in python?

598


How do you split a string in python?

615


Which software is used for python?

607


How to read a 10gb (or larger) file size in python?

545


What is difference between set and list in python?

552