Fibonacci-Generator

Sat 17 May 2025

title: "Fibonacci in Generator" author: "Rj" date: 2019-04-20 description: "-" type: technical_note draft: false


def fibonacci(n):
    a = b = 1

    for i in range(n):
        yield a
        a, b = b, a+b
print(2)
2
for x in fibonacci(10):
    print(x)
1
1
2
3
5
8
13
21
34
55


Score: 5

Category: basics