Last active
May 29, 2020 02:39
-
-
Save ZhouYang1993/4821211233a4e4c25f99b303c828ea48 to your computer and use it in GitHub Desktop.
Generators in Python
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
| def fibonacci(): | |
| x, y = 0, 1 | |
| while True: | |
| x, y = y, x + y | |
| yield x | |
| fib = fibonacci() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment