Skip to content

Instantly share code, notes, and snippets.

@vinipsmaker
Created January 31, 2014 18:49
Show Gist options
  • Save vinipsmaker/8740192 to your computer and use it in GitHub Desktop.
Save vinipsmaker/8740192 to your computer and use it in GitHub Desktop.
def fibonacci(n, consumer):
a,b = 0,1
consumer(a) #ret = [a]
for i in range(n):
a,b = b,a+b
consumer(a) #ret.append(a)
#return ret
fibonacci(10, print)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment