请补充一下代码:def fib(n): a = 0 b = 1 dic = ___(1)___ for i in ___(2)___: dic[i]=___(3)___ a,b=b,a+b return ___(4)___ fibonac = ___(5)___ for key in fibonac: print(fibonac[key], end=",")
时间: 2023-05-21 13:04:35 浏览: 89
print("数值1:%s" % a) print("数值2:%s" % b) "加法:", end="")
def fib(n):
a = 0
b = 1
dic = {1: a, 2: b}
for i in range(3, n+1):
dic[i]=a+b
a,b=b,a+b
return dic
fibonacci = fib(10)
for key in fibonacci:
print(fibonacci[key], end=",")
阅读全文