python-裴波那契数列

例如:#一定范围内的斐波那契数列;
def fb(arg1,arg2,stop):
if arg1==0:
print(arg1)
print(arg2)
arg3=arg1+arg2
print(arg3)
if arg3<stop:
fb(arg2,arg3,stop)

fb(0,1,30)

结果:

0
1
1
2
3
5
8
13
21
34



posted on 2017-01-11 11:14  舞曲  阅读(188)  评论(0编辑  收藏  举报

导航