Hi Guest

MobileUser

1 HomePage 1 Jobs 1 WalkIn 1Articles  

Cat Exam

 :) Latest Topic
AJAX
VB.NET
SQL Query
UDDI
CLASS
JavaScript Questions
SharePoint Interview
SilverLight
WCF
general knowledge
 ASP.NET
 :) Hot Jobs
 
 :) Latest Articles


  

 


Write down most common difference in between range() and xrange()?
Question Posted on 22 May 2022

Home >> 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.


 
 Input Your Comments Or suggestions(If Any)
 Name
 Email(optional)
 Comments


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?






 
Top Searches:asp net questions vb net questions sql query uddl questions class javascript Questions sharepoint interview questions and concept silverlight questions and concept wcf questions beans general knowledge ajax questions
PHP | Biztalk | Testing | SAP | HR |