8. Omitting Indices


#1


I am not stuck at this exercise but curious on the following. in idle 3.5.2 if I type in:
x=range(1,11)
print (x)
I get range(1,11)
rather than:
[1,2,...,10]

is this only due to version difference or am I missing something?


Replace this line with your code.


#2

It's definitely a version difference between python 2.x and 3.x. In python 3.x, range() went from creating a list to creating a generator.
Just add list(range(1,11) for python 3.x.

EDIT: Added more details.


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.