Skip to content

Instantly share code, notes, and snippets.

@ZhouYang1993
Last active May 29, 2020 02:39
Show Gist options
  • Save ZhouYang1993/4821211233a4e4c25f99b303c828ea48 to your computer and use it in GitHub Desktop.
Save ZhouYang1993/4821211233a4e4c25f99b303c828ea48 to your computer and use it in GitHub Desktop.
Generators in Python
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