Skip to content

Instantly share code, notes, and snippets.

@vinipsmaker
Created January 31, 2014 19:05
Show Gist options
  • Save vinipsmaker/8740822 to your computer and use it in GitHub Desktop.
Save vinipsmaker/8740822 to your computer and use it in GitHub Desktop.
def fibonacci():
a,b = 0,1
yield(a) #consumer(a)
while True:
a,b = b,a+b
yield(a) #consumer(a)
total = 0
for i in fibonacci():
total += i
print("Current: " + str(i))
print("Total: " + str(total))
if input('Type \'y\'<RET> to continue\n') != 'y':
break
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment