pre-PEP for optional 'pass'
Duncan Booth
duncan at NOSPAMrcp.co.uk
Thu Apr 18 04:21:30 EDT 2002
Gareth.McCaughan at pobox.com (Gareth McCaughan) wrote in
news:slrnabs3mm.1kfm.Gareth.McCaughan at g.local:
> A mathematician, a physicist and an engineer set out to
> prove that all odd numbers are prime.
>
> Mathematician: 3 is prime, 5 is prime, 7 is prime ...
> well, it's obviously a simple proof by induction. Trivial!
>
> Physicist: 3 is prime, 5 is prime, 7 is prime, hmm,
> 9 isn't prime: experimental error. 11, 13, ... yeah,
> must be right.
>
> Engineer: 3 is prime, 5 is prime, 7 is prime, 9 is prime,
> 11 is prime, 13 is prime, 15 is prime, ... [fades into distance]
>
> (These days there ought to be a computer scientist in the
> mix too. Suggestions?)
Computer Scientist:
The computer scientist writes a program to test every odd number and see
whether it is prime:
i, allprime = 3, True
try:
while 1:
if not isprime(i): allprime = False
i += 2
except OverflowError:
pass # Ok, we tested everything we could
print allprime and "Passed" or "Failed"
Still waiting for the results! (Python 2.2.1 of course)
--
Duncan Booth duncan at rcp.co.uk
int month(char *p){return(124864/((p[0]+p[1]-p[2]&0x1f)+1)%12)["\5\x8\3"
"\6\7\xb\1\x9\xa\2\0\4"];} // Who said my code was obscure?
More information about the Python-list
mailing list