Created
January 1, 2021 20:02
-
-
Save ahmed4end/cb9434135554ab723fcc207c5e52d732 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
#Python - Fibonacci sequence (Lazy solution). | |
def feb(first=0, second=1): | |
Next = first+second | |
yield Next | |
yield from feb(first=second, second=Next) | |
obj = feb() | |
for i in range(25): | |
#calculate only the next number in loop (lazy). | |
print(next(obj), end=' ') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment