python实现斐波那契数列

通过生成器方式

def fib_loop_while(max):
    a, b = 0, 1
    while max > 0:
        a, b = b, a + b
        max -= 1
        yield a


for i in fib_loop_while(10):
    print(i)
原文地址:https://www.cnblogs.com/come202011/p/12731933.html