Python的斐波那契写法

版权声明:本文为博主原创文章,未经博主允许也可以得转载。 https://blog.csdn.net/zrcshendustudy/article/details/82317569
def fib(n):
    a, b = 0, 1
    while a < n:
        print(a, end=' ')
        a, b = b, a+b
    print()
fib(1000)

猜你喜欢

转载自blog.csdn.net/zrcshendustudy/article/details/82317569
今日推荐