Skip to content

Instantly share code, notes, and snippets.

@vinipsmaker
Last active August 29, 2015 14:16
Show Gist options
  • Save vinipsmaker/23673b16148d4f04a99f to your computer and use it in GitHub Desktop.
Save vinipsmaker/23673b16148d4f04a99f to your computer and use it in GitHub Desktop.
from itertools import islice
def fibonacci():
a,b = 0,1
yield(a)
while True:
a,b = b,a+b
yield(a)
print(list(islice(fibonacci(), 10)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment