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()
posted @ 2011-03-09 12:57  tt-0411  阅读(156)  评论(0编辑  收藏  举报