SHARE
TWEET

CSH2012 LAB12 fibonacci.py

calcpage Jun 1st, 2013 164 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/usr/bin/python
  2. #fibonacci.py    MrG   2013.0528
  3.  
  4. def fib(one, two, n):
  5.     if n==1:
  6.         return one
  7.     if n==2:
  8.         return two
  9.     return fib(one,two,n-1)+fib(one,two,n-2)
  10.  
  11. for n in range(100):
  12.     print n, "\t" ,1.0*fib(2,-3,n+2)/fib(2,-3,n+1)
RAW Paste Data
Top