[New-bugs-announce] [issue1500] Example using range doesn't give claimed results
Steve Jones
report at bugs.python.org
Mon Nov 26 21:51:30 CET 2007
New submission from Steve Jones:
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
----------
components: Documentation
messages: 57852
nosy: basingwerk
severity: minor
status: open
title: Example using range doesn't give claimed results
type: behavior
versions: Python 3.0
__________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue1500>
__________________________________
More information about the New-bugs-announce
mailing list