Skip to content

Instantly share code, notes, and snippets.

@ZhouYang1993
Created May 29, 2020 02:37
Show Gist options
  • Save ZhouYang1993/6d66720bda0753fc4d749d705364955c to your computer and use it in GitHub Desktop.
Save ZhouYang1993/6d66720bda0753fc4d749d705364955c 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
p = fibonacci()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment