Am 15.09.14 04:40, schrieb Seymore4Head:
nums=range(1,11)
print (nums)

I don't understand why the command nums=range(1,11) doesn't work.
I would think that print(nums) should be 1,2,3 ect.
Instead it prints range(1,11)

It does work, but in a different way than you might think. range() does not return a list of numbers, but rather a generator - that is an object which produces the values one after another. But you can transform it into a list:

print(list(nums))

should give you what you want.

        Christian
--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to