兔子数列

# -*- coding:utf-8 -*-
import time

def fbis(num):
    result=[0,1]
    for i in range(num-2):
        result.append(result[-2]+result[-1])
    return result
def main():
    result = fbis(10)
    fobj = open('C:\\text.txt','w+')
    for i,num in enumerate(result):
        print u"第%d个数是:%d"%(i,num)
        fobj.write("%d"%num)
        time.sleep(1)
if __name__ == '__main__':
    main()
阅读更多
上一篇django框架中manage.py runserver出现错误
下一篇Name error name admin is not defined
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

关闭
关闭