Advertisement
calcpage

CSH2012 LAB12 fibonacci.py

Jun 1st, 2013
390
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.26 KB | None | 0 0
  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)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement