Skip to content

Instantly share code, notes, and snippets.

@mengzhuo
Created May 23, 2014
Embed
What would you like to do?
Fib generator
def fib():
x, y = 0,1
while True:
yield x
x, y = y,x+y
fibgen=fib()
print [fibgen.next() for x in xrange(40)]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment