Created
November 16, 2012 15:42
-
-
Save stpierre/4088324 to your computer and use it in GitHub Desktop.
Python FizzBuzz
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
for n in range(1, 101): | |
output = [] | |
if n % 3 == 0: | |
output.append("Fizz") | |
if n % 5 == 0: | |
output.append("Buzz") | |
if not output: | |
print(str(n)) | |
else: | |
print("".join(output)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I rather do like this implementation.