Skip to content

Instantly share code, notes, and snippets.

@akayj
Last active November 6, 2015 03:12
Show Gist options
  • Save akayj/31e42ca5f0d2dcf9e634 to your computer and use it in GitHub Desktop.
Save akayj/31e42ca5f0d2dcf9e634 to your computer and use it in GitHub Desktop.
Fibonacci generator
#!/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