[Tutor] fibonacci
janos.juhasz@VELUX.com
janos.juhasz@VELUX.com
Wed Feb 12 03:48:03 2003
Dear All,
I have cut it from the activepython help, because of its beauty:
# Fibonacci numbers module
def fib(n): # write Fibonacci series up to n
a, b =3D 0, 1
while b < n:
print b,
a, b =3D b, a+b
def fib2(n): # return Fibonacci series up to n
result =3D []
a, b =3D 0, 1
while b < n:
result.append(b)
a, b =3D b, a+b
return result
I know it needs a little modification, but it is uses that nice feature=
of
python that isn't available most of other programing languages.
I mean, assign values for lists.
Which languages support so well the list?
Best regards,
-----------------------
Juh=E1sz J=E1nos
IT department
=