Can python find fibonacci series in a single line of code?
Bernhard Herzog
bh at intevation.de
Tue Nov 12 06:48:26 EST 2002
Following up to myself :)
> Next we get rid of that unnecessary multiple assignment at the beginning
> and use long ints to avoid the overflow error:
>
> python -c "a = b = 1L; exec('while 1: print a; a,b=b,a+b')"
It shows I used Python 2.1. In 2.2 ints are automatically promoted to
longs if necessary.
Bernhard
--
Intevation GmbH http://intevation.de/
Sketch http://sketch.sourceforge.net/
MapIt! http://www.mapit.de/
More information about the Python-list
mailing list