n= int(input())
for i in range(n+1):
def f(x):
print(x)
if i<=1:
f(i)
elif i>1:
f(i-1) + f(i-2)
答案 0 :(得分:0)
您需要先定义斐波那契函数,像这样:
def f(x):
if(x <= 1):
return x
else:
return (f(x - 2)+ f(x - 1))
n = int(input())
print(f(n))