Skip to content

Instantly share code, notes, and snippets.

@pgebert
Created February 1, 2022 18:45
Python generator for fibonacci numbers.
/**
* Created by pgebert on 01/02/22.
*
* Iterator for fibonacci numbers.
*/
from typing import Iterator
def fibonacci() -> Iterator[int]:
a, b = 1, 1
while True:
yield a
a, b = b, a + b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment