斐波那契數列 生成器

環境:Python 2.7python # Fibonacci # 斐波那契數列 def fib(): a, b = 0, 1 while True: yield a a, b = b, a + b from itertools import islice print list(islice(fib(), 20))
相關文章
相關標籤/搜索