Learning starts with a question. Asking is a signal for knowledge request!
First time here? Checkout the FAQs!
x

How "image search" works

0 like 0 dislike
364 views
What is the different between range () and xrange () functions in Python?
in Data Science & Statistics by Bronze Status (5.6k points) | 364 views

1 Answer

1 like 0 dislike
Best answer

Both range() and xrange() are built-in functions in Python that are used to generate integers or whole numbers in a given range . The python range() and xrange() comparison is relevant only if you are using both Python 2.x and Python 3 . It is because the range() function in python 3.x is just a re-implementation of the xrange() of python 2.x. It actually works the same way as the xrange does.

 

Deprecation of xrange()

 

In Python 3.x, the xrange() function does not exist anymore. The range() function now does what xrange() does in Python 2.x, so to keep your code portable, you might want to stick to using range() instead. Of course, you could always use the 2to3 tool that Python provides in order to convert your code, but that introduces more complexity. 

 

by (16 points)
selected by

Related questions

2 like 0 dislike
1 answer
0 like 0 dislike
1 answer
0 like 0 dislike
1 answer
1 like 0 dislike
1 answer
0 like 0 dislike
1 answer
2 like 0 dislike
1 answer
0 like 0 dislike
1 answer
0 like 0 dislike
1 answer
asked Jun 26, 2020 in Data Science & Statistics by Student Bronze Status (5.7k points) | 256 views
0 like 0 dislike
1 answer
0 like 0 dislike
1 answer
0 like 0 dislike
0 answers
0 like 0 dislike
1 answer
0 like 0 dislike
1 answer
1 like 0 dislike
1 answer
asked Aug 24, 2020 in Mathematics by joshua-mwanza Gold Status (26.7k points) | 194 views

Join MathsGee Q&A, where you get instant answers to your questions from our AI, AstraNova and verified by human experts. We use a combination of generative AI and human experts to provide you the best solutions to your problems.

On the MathsGee Q&A, you can:

1. Get instant answer to your questions

2. Convert image to latex

3. AI-generated answers and insights

4. Get expert-verified answers

5. Vote on questions and answers

6. Tip your favorite community members

7. Join expert live video sessions (Paid/Free)

8. Earn points by participating

9. Take a course

10. Enjoy our interactive learning resources


Posting on the MathsGee Q&A

1. Remember the human

2. Act like you would in real life

3. Find original source of content

4. Check for duplicates before publishing

5. Read the community guidelines


MathsGee Q&A Rules

1. Answers to questions will be posted immediately after moderation

2. Questions will be queued for posting immediately after moderation

3. Depending on the number of messages we receive, you could wait up to 24 hours for your message to appear. But be patient as posts will appear after passing our moderation.


MathsGee Q&A

MathsGee Q&A