Can python find fibonacci series in a single line of code?
Duncan Booth
duncan at NOSPAMrcp.co.uk
Tue Nov 12 04:32:35 EST 2002
a_human_work at hotmail.com (Pittaya) wrote in
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?
>
Ca you explain please (because I don't really know Perl) what a program
that prints 1.#INF over and over again has to do with Fibonacci (at least
thats who who I think you meant)?
Jeff's nice clear Python program prints out a Fibonacci series, but the
Perl one just seem to print a bit of a Fibonacci series which doesn't
strike me as terribly useful. Even the numbers it does print are mostly
approximations.
--
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