saving . . . saved range() has been deleted. range() has been hidden .
range()
Title
Question
in the tutorial  there is a question 
what will be the output of range(1,5)? The answer for this is mentioned in it is [1,2,3,4]
but in the interpreter if we give this the output will be range(1,5). Please explain what happens actually when range() function invokes.
How this works in for loop

Python-3.4.3 Getting-started-with-for 04-05 min 50-60 sec 22-06-19, 5:32 p.m. Cinil

Answers:

In new python versions range function is a generator, in older python version it used to be a list. That is why the outputs are different. However, generators work perfectly fine when used in for loops.

Please try to see Generators in Python official docs if you wish to understand what they are.
22-06-19, 5:46 p.m. ankitrj.iitb


for i in range(1,5):
    print(I)
we will get the out put
1
2
3
4
if your code is
for i in range(5):
print(I)
then the output will be
0
1
2
3
4
5


01-07-19, 7:01 p.m. npswamy2006



01-07-19, 7:02 p.m. npswamy2006


Log-in to answer to this question.