Skip to content

Instantly share code, notes, and snippets.

@benkamphaus
Last active August 29, 2015 14:04
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 benkamphaus/5d657affcdd551a36002 to your computer and use it in GitHub Desktop.
Save benkamphaus/5d657affcdd551a36002 to your computer and use it in GitHub Desktop.
FizzBuzz for laughs in Python
def fbuzz(x):
str_rep = ""
if (x % 3) == 0:
str_rep += "Fizz"
if (x % 5) == 0:
str_rep += "Buzz"
if not str_rep:
str_rep += str(x)
return str_rep
print([fbuzz(x) for x in range(1, 101)])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment