Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
A Fizzbuzz implementation: modular and extensible
lookup = {3: "Fizz", 5: "Buzz"}
def is_multiple(n, m):
return n % m == 0
def fizzbuzz(n):
output = ""
for m, string in lookup.items():
if is_multiple(n, m):
output += string
if not output:
output = str(n)
return output
for i in range(100):
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment