Differentiate between range and xrange.

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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Mention what are the rules for local and global variables in Python?

664


What is the scipy?

636


What is python magic method?

572


What are non static methods?

592


How to create dynamic array in python?

568






What are the ones that can be used with pandas?

566


Does python have a string ‘contains’ substring method?

642


What good is recursion?

657


Why lambda forms in python do not have statements?

588


What are the basic datatypes in python?

601


What is the best free ide for python?

534


What is blob in python?

528


What applications use python?

544


How would you create an empty numpy array in python?

621


What is a numpy array?

558