Created
April 4, 2018 15:38
-
-
Save yon2004/e55d85d6c9d597c379630940645cc968 to your computer and use it in GitHub Desktop.
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
#Fizz buzz is a group word game for children to teach them about division. | |
#Players take turns to count incrementally, replacing any number divisible by three with the word "fizz" | |
#and any number divisible by five with the word "buzz". | |
def FizzBuzz(fizz_num): | |
out = [] | |
if fizz_num % 3 == 0: | |
out.append("Fizz") | |
if fizz_num % 5 == 0: | |
out.append("Buzz") | |
if out: | |
return "".join(out) | |
else: | |
return "{}".format(fizz_num) | |
for number in range(1, 101): | |
print(FizzBuzz(number)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment