# Golden.py """ Given n, this script displays the n-th Fibonacci number and ratio and the (n+1)-st Fibonacci number and ratio. """ from math import sqrt n = input('Enter a positive integer <=35 :') a = (1+sqrt(5))/2 b = (1-sqrt(5))/2 # The n-th Fibonacci number and ratio... f = (a**n - b**n)/sqrt(5) f_next = (a**(n+1) - b**(n+1))/sqrt(5) r = f_next/f print ' %2d %10d %18.15f ' % (n,f,r) print 'chh' n = n+1 # The next Fibonacci number and ratio... f = (a**n - b**n)/sqrt(5) f_next = (a**(n+1) - b**(n+1))/sqrt(5) r = f_next/f print ' %2d %10d %18.15f ' % (n,f,r)