mistake in python tutorial
Miriam Gomez Rios
miriam.gomezrs at udlap.mx
Tue Jun 5 21:43:07 EDT 2012
Hello, I think that the example in section 4.4 in the tutorial for python 2.7X is wrong.
http://docs.python.org/tutorial/controlflow.html
It will end up printing this if you run the exact code listed in the tutorial.
3 is a prime number
4 equals 2*2
5 is a prime number
5 is a prime number
5 is a prime number
6 equals 2 * 3
7 is a prime number
7 is a prime number
7 is a prime number
7 is a prime number
7 is a prime number
8 equals 2*4
9 is a prime number
9 equals 3*3
I believe it is because the is no break in " else print n is a prime number" and
it never prints anything about number 2 because the second for is like range(2,2)
which is empty so it does nothing.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20120606/2110557c/attachment.html>
More information about the Python-list
mailing list