Can python find fibonacci series in a single line of code?
logistix
logistix at zworg.com
Mon Nov 11 17:38:10 EST 2002
a_human_work at hotmail.com (Pittaya) wrote in message news:<fa61a3d8.0211110720.16a645f8 at posting.google.com>...
> 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?
Guys, c'mon. How are you supposed to lock up your computer when you
only print the first 10 numbers?
python -c "a,b=1,1;exec('while 1:\n\tglobal a,b\n\tprint
a\n\ta,b=b,a+b\n\n')"
More information about the Python-list
mailing list