指定 style tar https 递归 com code lan pri
- # 斐波那契数列
- # 1,1,2,3,5,8,13....
- 1)用递归函数实现斐波那契数列:
- (指定第几个斐波那契数)
- def fib(n):
- if n == 1 or n == 2:
- return 1
- return fib(n-1)+fib(n-2)
- print(fib(100))
实现斐波那契数列
指定 style tar https 递归 com code lan pri
原文:http://www.cnblogs.com/bigtreei/p/7805975.html
来源: http://www.bubuko.com/infodetail-2386461.html