Can python find fibonacci series in a single line of code?

Jeff Epler jepler at unpythonic.net
Mon Nov 11 11:48:35 EST 2002


On Mon, Nov 11, 2002 at 07:20:20AM -0800, Pittaya wrote:
> My Perl-addicted friend shows me that he can find fibanicci series in
> a single line of code.
> 
> perl -le '$b=1; print $a+=$b while print $b+=$a'
> 
> can python do something like this?
> -- 
> http://mail.python.org/mailman/listinfo/python-list

Personally, I think this is the best program for computing the fibonacci
sequence:

import zlib,base64;exec zlib.decompress(base64.decodestring('eNpLtE2yNeQqz8jMSVUwtOJSSNRJsk3STtRJ5FIoKMrMK1FI5AIAsOwJ0A=='))

it's as unreadable as the best Perl code IMO

Jeff




More information about the Python-list mailing list