Skip to content

Instantly share code, notes, and snippets.

@iLoveTux
Created August 29, 2016 21:29
Show Gist options
  • Save iLoveTux/c33e15a47544ca29c958735bef10f619 to your computer and use it in GitHub Desktop.
Save iLoveTux/c33e15a47544ca29c958735bef10f619 to your computer and use it in GitHub Desktop.
fizz buzz implementation in Python 3
from functools import partial
# Algorithm needs to avoid newlines being appended to output
pr = partial(print, end="")
for n in range(1, 101):
if n%3 == 0:
pr("Fizz")
if n%5 == 0:
pr("Buzz")
if all([n%3, n%5]):
pr(n)
pr("\n")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment