python ----Fibonacci数列
1.实现Fibonacci数列
代码:
#斐波那契数列
def fibo(n):
a1,a2 = 0,1
for i in range(n+1):
a1,a2 = a2,a1+a2
return a1
n = int(input())
if(n>0):
for i in range(n):
print(fibo(i),end=' ')
#input:10 output:1 1 2 3 5 8 13 21 34 55