Skip to content

Instantly share code, notes, and snippets.

@md2perpe
Created December 28, 2020 18:38
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 md2perpe/8bb941012125ac2caddb85ad00a62b9e to your computer and use it in GitHub Desktop.
Save md2perpe/8bb941012125ac2caddb85ad00a62b9e to your computer and use it in GitHub Desktop.
FizzBuzz
from itertools import count, cycle
for (n, d3, d5) in zip(count(0), cycle([True, False, False]), cycle([True, False, False, False, False])):
print(("Fizz" if d3 else "")+("Buzz" if d5 else "") or str(n))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment