斐波那契数列
'''
#
def fib(n,a=1,b=1):
if n==1 or n==2:
return b
elif n>=2:
a,b=b,a+b
return fib(n-1,a,b)
ret=fib(10)
print(ret)
'''
'''
#
def fib(n):
a,b=(1,1)
while n>2:
a,b=b,a+b
n-=1
return b
ret=fib(10)
print(ret)
'''
#
def fib(n):
if n==1 :
yield 1
else:
yield from( 1,1)
a,b=(1,1)
while n>2:
a,b=b,a+b
n-=1
yield b
ret=fib(10)
for i in ret:
print(i)