Python入门程序:Fibonacci sequence

#3_20.py

#The program to give the certain integer according its index

#in the Fibonacci sequence

#by ggt

 

def x():

     al = 1

     ar = 0

     n = input("Enter the index of the integer in the Fibonacci sequece: ")

     for f in range(1,n+1):

         t = ar

         ar = al + ar

         al = t

     print 'The result is',ar



x()

你可能感兴趣的:(fibonacci)