Quantcast
Channel: Jack @ ASP.NET » Python
Viewing all articles
Browse latest Browse all 8

Fibonacci series up to n in Python

$
0
0
>>> def fib(n): …      a, b = 0, 1 …      while b < n: …          print b, …          a, b = b, a+b … >>> fib(50) 1 1 2 3 5 8 13 21 34

Viewing all articles
Browse latest Browse all 8

Trending Articles