Python User defined function demonstration, calculating Fibonacci sequence

From , 4 Years ago, written in Python, viewed 52 times.
URL https://pastebin.vip/view/e4270771
  1. #------------------------------------------------------------------------------
  2. #           Name: function.py
  3. #         Author: Kevin Harris
  4. #  Last Modified: 02/13/04
  5. #    Description: This Python script demonstrates how to create a function
  6. #                 that writes the Fibonacci series up to n.
  7. #------------------------------------------------------------------------------
  8.  
  9. def fibonacci( n ):
  10.     a, b = 0, 1
  11.     while b < n:
  12.         print( b )
  13.         a, b = b, a+b
  14.  
  15. # Now call the function we just defined...
  16.  
  17. fibonacci( 2000 )
  18.  
  19. input( '\n\nPress Enter to exit...' )
  20.  
  21.  
  22.  
  23. #//python/8092

Reply to "Python User defined function demonstration, calculating Fibonacci sequence"

Here you can reply to the paste above

captcha

https://burned.cc - Burn After Reading Website