Skip to content

Instantly share code, notes, and snippets.

@jakelosh
Created March 30, 2020 16:29
Show Gist options
  • Save jakelosh/bd0c957b947791b6e376800a7c472603 to your computer and use it in GitHub Desktop.
Save jakelosh/bd0c957b947791b6e376800a7c472603 to your computer and use it in GitHub Desktop.
An implementation of FizzBuzz in Python
def fizz_buzz(start, stop, fizz_val, buzz_val):
for i in range(start, stop):
str_out = ""
if i % fizz_val == 0:
str_out += "Fizz"
if i % buzz_val == 0:
str_out += "Buzz"
if str_out == "":
str_out += str(i)
print(str_out)
if __name__ == "__main__":
fizz_buzz(1, 101, 3, 5)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment