Created
February 1, 2022 18:45
-
-
Save pgebert/3d5b322cd4652d7ce354f34eea3d7bce to your computer and use it in GitHub Desktop.
Python generator for fibonacci numbers.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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