Can python find fibonacci series in a single line of code?
Michael Hudson
mwh at python.net
Tue Nov 12 09:25:05 EST 2002
Bernhard Herzog <bh at intevation.de> writes:
> 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...
OK. We can lose the print too:
python2.2 -c "a=b=1; eval(compile('while 1:a,b=b,a+b;a\n','','single'))"
That wasn't what you meant? Oh well.
Cheers,
M.
--
I never realized it before, but having looked that over I'm certain
I'd rather have my eyes burned out by zombies with flaming dung
sticks than work on a conscientious Unicode regex engine.
-- Tim Peters, 3 Dec 1998
More information about the Python-list
mailing list