
Hi there
The prime number function in 4.4 breaks and continue statements is wrong.
Jon
Sent from my iPad
____________________________________________________________________________________ 8:00? 8:25? 8:40? Find a flick in no time with the Yahoo! Search movie showtime shortcut. http://tools.search.yahoo.com/shortcuts/#news

Hi Jon,
On Wed, Feb 9, 2011 at 05:21, Jon jongoldsteinis@yahoo.com wrote:
Hi there
The prime number function in 4.4 breaks and continue statements is wrong.
Care to explain why? I can see it works as expected:
$ ./python Python 3.2rc3+ (py3k, Feb 17 2011, 21:31:25) [GCC 4.4.5] on linux2 Type "help", "copyright", "credits" or "license" for more information.
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 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
Regards,
participants (2)
-
Jon
-
Sandro Tosi