python算法学习之斐波那契数列
程序员文章站
2023-03-12 10:44:09
python算法学习之斐波那契数列
# 斐波那契
def fib(m):
n, a, b = 1, 0, 1
while n <= m:...
python算法学习之斐波那契数列
# 斐波那契 def fib(m): n, a, b = 1, 0, 1 while n <= m: print(b) a,b = b,a+b n = n +1 fib(10) 结果: 1 1 2 3 5 8 13 21 34 55