Skip to content

Instantly share code, notes, and snippets.

@ipartola
Last active December 26, 2015 20:19
Show Gist options
  • Save ipartola/7207829 to your computer and use it in GitHub Desktop.
Save ipartola/7207829 to your computer and use it in GitHub Desktop.
FizzBuzz using Python generators
def fizz():
while True:
yield ''
yield ''
yield 'fizz'
def buzz():
while True:
yield ''
yield ''
yield ''
yield ''
yield 'buzz'
f = fizz()
b = buzz()
for i in range(1, 101):
print((f.next() + b.next()) or i)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment