This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Example using range doesn't give claimed results
Type: behavior Stage:
Components: Documentation Versions: Python 3.0
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: basingwerk, gvanrossum
Priority: normal Keywords:

Created on 2007-11-26 20:51 by basingwerk, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (2)
msg57852 - (view) Author: Steve Jones (basingwerk) Date: 2007-11-26 20:51
See for yourself, on
http://docs.python.org/tut/node6.html
*************************************

>>> for n in range(2, 10):
...     for x in range(2, n):
...         if n % x == 0:
...             print n, 'equals', x, '*', n/x
...             break
...     else:
...         # loop fell through without finding a factor
...         print n, 'is a prime number'
... 
2 is a prime number ----- this bit is wrong
3 is a prime number
4 equals 2 * 2
5 is a prime number
6 equals 2 * 3
7 is a prime number
8 equals 2 * 4
9 equals 3 * 3
msg57854 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2007-11-26 21:14
2 *is* a prime number.
History
Date User Action Args
2022-04-11 14:56:28adminsetgithub: 45841
2007-11-26 21:14:16gvanrossumsetstatus: open -> closed
resolution: not a bug
messages: + msg57854
nosy: + gvanrossum
2007-11-26 20:51:30basingwerkcreate