"Gregory Morton" <tyethec...@hotmail.com> wrote

I've been reading this Python 3.0.1 tutorial(http://docs.python.org/3.0/tutorial/controlflow.html),

Looks like a bug in the tutorial! In Python 3 you cannot just print a range
it is now a generator. Notice that in the tutorial the range() calls are not
shown at the >>> prompt.
They are not valid commands, the tutorial is just illustrating the expected
output from range for those values!

To see them you need to explicitly convert it to a list:

list( range(0, 10, 3) )
[0, 3, 6, 9]

list( range(-10, -100, -30) )
[-10, -40, -70]

HTH,


--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/l2p/

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to