Differentiate between range and xrange.

Answers were Sorted based on User's Feedback



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

Differentiate between range and xrange...

Answer / glibwaresoftsolutions

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

Differentiate between range and xrange...

Answer / 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

More Python Interview Questions

How does break, continue and pass work?

0 Answers  


What does this mean: *args, **kwargs? And why would we use it?

0 Answers  


What statement is used in python if the statement is required syntactically but no action is required for the program?

0 Answers  


What is the use of the // operator?

0 Answers  


Why does the following behave unexpectedly in python?

0 Answers  






Which website is best for learning python?

0 Answers  


Why is it important?

0 Answers  


Should I use single or double quotes in python?

0 Answers  


Explain the use of the split function in python?

0 Answers  


Is python a scripting or programming?

0 Answers  


What is json? How would convert json data into python data?

0 Answers  


What is python tuples and how is it different from lists?

0 Answers  


Categories