Can python find fibonacci series in a single line of code?
Mel Wilson
mwilson at the-wire.com
Tue Nov 12 05:33:42 EST 2002
In article <bdb5b58f.0211111438.640885d2 at posting.google.com>,
logistix at zworg.com (logistix) wrote:
>a_human_work at hotmail.com (Pittaya) wrote in message news:<fa61a3d8.0211110720.16a645f8 at posting.google.com>...
>> [ ... ] find fibanicci series in
>> a single line of code. [ ... ]
>Guys, c'mon. How are you supposed to lock up your computer when you
>only print the first 10 numbers?
Ah, well, if it's locking up the computer you're after, do it
in unary arithmetic..
print reduce (lambda x,y: x+[x[-1]+x[-2]], xrange(10), ['1','1'])
(Don't say `xrange(100)` unless you're sure you mean it.)
Regards. Mel.
More information about the Python-list
mailing list