[Chicago] Python Tutorial 4.6 function fib()

Ted Pollari tcp at mac.com
Sun Jan 6 03:54:46 CET 2008


On Jan 5, 2008, at 8:25 PM, Patrick O'Hara wrote:

>  fib(n):  # Fibonacci
>    a,b=0,1
>   while b < n:
>     print b,
>    a,b = b, a*b
>


   a,b = b, a+b

see http://en.wikipedia.org/wiki/Fibonacci_number


More information about the Chicago mailing list