Created
March 30, 2020 16:29
-
-
Save jakelosh/bd0c957b947791b6e376800a7c472603 to your computer and use it in GitHub Desktop.
An implementation of FizzBuzz in Python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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