Created
June 4, 2015 13:50
-
-
Save manxisuo/794f562b39db0e5958fa to your computer and use it in GitHub Desktop.
斐波那契数列生成器
This file contains 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(): | |
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