Created
February 1, 2022 18:45
Python generator for fibonacci numbers.
This file contains hidden or 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