Differentiate between range and xrange.



Differentiate between range and xrange...

Answer / nashiinformaticssolutions

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

More Python Interview Questions

What is python coded in?

0 Answers  


Can a constructor be inherited?

0 Answers  


What does tuple mean?

0 Answers  


Which is better r or python?

0 Answers  


How do you sort in python?

0 Answers  






Does python has classes?

0 Answers  


Explain how Python is an interpreted language

1 Answers  


What is zip () in python?

0 Answers  


Do you know how is multithreading achieved in python?

0 Answers  


Explain the //, %, and ** operators in python?

0 Answers  


What is flask- wtf? Explain its features.

0 Answers  


What is the best Django or PHP?

0 Answers  


Categories