Differentiate between range and xrange.
Answers were Sorted based on User's Feedback
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 |
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 |
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 |
What is set () in python?
Which python library would you prefer to use for data munging?
Why do array indexes start with 0 in most languages?
What is a lambda in coding?
What is the difference between the shallow copy and deep copy in python?
Can notepad ++ run python?
What is pip?
What does input () do in python?
How is unit test done in python?
Is there an inherent do-while loop in Python?
List down some of the pdb commands for debugging python programs?
Differentiate between lists and tuples?