A function that writes the Fibonacci series to an arbitrary boundary : Function Define : Function PYTHON examples


PYTHON examples » Function » Function Define »

 

A function that writes the Fibonacci series to an arbitrary boundary


A function that writes the Fibonacci series to an arbitrary boundary
 



def fib(n):    # write Fibonacci series up to n
     """Print a Fibonacci series up to n."""
     a, b = 01
     while b < n:
         print b,
         a, b = b, a+b
 
# Now call the function we just defined:
fib(2000)

           
         
  



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


PYTHON examples

 Navioo Function
» Function Define