Skip to content

Instantly share code, notes, and snippets.

@manxisuo
Created June 4, 2015 13:50
Show Gist options
  • Save manxisuo/794f562b39db0e5958fa to your computer and use it in GitHub Desktop.
Save manxisuo/794f562b39db0e5958fa to your computer and use it in GitHub Desktop.
斐波那契数列生成器
def fibonacci():
a = b = 1
yield a
yield b
while True:
a, b = b, a + b
yield b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment