#------------------------------------------------------------------------------ # Fibonacci1.py #------------------------------------------------------------------------------ def fib(n): """ returns a list of Fibonacci numbers, up to the nth, where n>=2 """ L = [0,1] for i in range(2,n+1): next = L[-1] + L[-2] L.append(next) return L # end fib() #-- main program -------------------------------------------------------------- n = int(input('Enter the index of a Fibonacci number: ')) F = fib(n) for i in range(len(F)): print(i, '\t', F[i])