Skip to content

Instantly share code, notes, and snippets.

@pgebert
Created February 1, 2022 18:45
Show Gist options
  • Save pgebert/3d5b322cd4652d7ce354f34eea3d7bce to your computer and use it in GitHub Desktop.
Save pgebert/3d5b322cd4652d7ce354f34eea3d7bce to your computer and use it in GitHub Desktop.
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