Created
April 13, 2021 11:09
-
-
Save cristinelpopescu/496ea18939cabdf5155534ed001bb106 to your computer and use it in GitHub Desktop.
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
# fibonacci - generator | |
def fib(number): | |
a = 0 | |
b = 1 | |
for i in range(number): | |
yield a | |
temp = a | |
a = b | |
b = temp + b | |
for x in fib(20): | |
print(x) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment