Skip to content

Instantly share code, notes, and snippets.

@kstrauser
Last active January 19, 2017 19:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kstrauser/55d5f240c93a40f1c99df90de9c79dbd to your computer and use it in GitHub Desktop.
Save kstrauser/55d5f240c93a40f1c99df90de9c79dbd to your computer and use it in GitHub Desktop.
from itertools import count
def fizz():
for i in count(1):
yield '' if i % 3 else 'fizz'
def buzz():
for i in count(1):
yield '' if i % 5 else 'buzz'
def combine():
for i, f, b in zip(count(1), fizz(), buzz()):
yield f + b if f or b else i
for _, c in zip(range(100), combine()):
print(c)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment