Can python find fibonacci series in a single line of code?
Duncan Booth
duncan at NOSPAMrcp.co.uk
Tue Nov 12 07:09:56 EST 2002
Bernhard Herzog <bh at intevation.de> wrote in
news:6q7kfjau4f.fsf at salmakis.intevation.de:
>
> python -c "a = b = 1L; exec('while 1: print a; a,b=b,a+b')"
>
> It would be nice to get rid of that exec, too...
You could get rid of the unnecessary parentheses after the exec. And as for
the whitespace, are you trying to make it readable or something?:
python -c "a=b=1;exec'while+1:print+a;a,b=b,a+b'"
Who ever said Python programs need whitespace!
--
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