crackyourinterview.com


To improves our performance please Like Share Subscribe(Will boost us)

Write down most common difference in between range() and xrange()?
Question Posted on 22 May 2022Home >> Python Programming >> Python Questions >> Write down most common difference in between range() and xrange()?

Write down most common difference in between range() and xrange()?
Basically range() and xrange() are mainly used to iterate in a for loop for a fixed number of times. By function both of these functions are same. And the only difference when we talk about python version support and their return values.
0
0

Base of differencerange() Methodxrange() Method
SupportWhen we say about Python 3 xrange() is not supported and only range() function is sued to iterate in for loops.xrange() function is used in Python 2 to iterate in for loops
Returns typerange() method is mainly returns a listxrange() returns a generator object as it doesnot really generate a static list at the run time
Memory Usedrange() method will take more memory as it needs to keeps the entire list of iterating numbers in memoryAnd on another hand xrange()will take less memory due to it keeps only one number at a time in memory.


.


Most Visited Questions:-

Deep Learning Questions Answers
Below are the different Deep Leaning Questions and answer a More...

Continuous Integration Questions Answers
Below are the 20 odd questions for CI or Continuous Integra More...

Derived relationships in Association Rule Mining are represented in the form of __________.
Derived relationships in Association Rule Mining are repres More...

What is Gulpjs and some multiple choice questions on Gulp
Gulpjs is an open source whihc helps in building Javascript More...

Microservices Architecture Questions Answers
Below are the different questions on Microservices Architec More...




Other Important Questions

Program to check sequence is palindrome or not?

Can you define Memory Management in Python?

Can you define dictionary in Python?

Can you please mention some builtin Data Types in Python?

Write a code to read JSON file and print data of JSON in Python?






@2014-2022 Crackyourinterview (All rights reserved)
Privacy Policy - Disclaimer - Sitemap