Skip to content

Latest commit

 

History

History
18 lines (14 loc) · 247 Bytes

File metadata and controls

18 lines (14 loc) · 247 Bytes
@author jackzhenguo
@desc 
@date 2019/11/23

126 斐波那契数列前n项

def fibonacci(n):
    a, b = 1, 1
    for _ in range(n):
        yield a
        a, b = b, a + b


list(fibonacci(5))  # [1, 1, 2, 3, 5]