5 Nov
2010
5 Nov
'10
6:51 a.m.
Hi Team, It's not technically a bug, but the following code (on page http://docs.python.org/tutorial/datastructures.html#functional-programming-t...) is claimed to compute primes, but it does not return only primes...
def f(x): return x % 2 != 0 and x % 3 != 0 ... filter(f, range(2, 25)) [5, 7, 11, 13, 17, 19, 23] Sure, for the range given in the filter only primes are returned, but if this range was expanded, composites would sneak in. Great docs though! I'm new to Python and the examples are fantastic. Cheers, John
4919
Age (days ago)
4919
Last active (days ago)
0 comments
1 participants
participants (1)
-
John Baumgartner