Last active
November 6, 2015 03:12
-
-
Save akayj/31e42ca5f0d2dcf9e634 to your computer and use it in GitHub Desktop.
Fibonacci generator
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
#!/usr/bin/env python2 | |
def fib(max): | |
a, b = 0, 1 | |
for _ in xrange(n): | |
yield b | |
a, b = b, a+b | |
for i in fib(10): | |
print i, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment