Last active
June 23, 2018 22:02
-
-
Save thomasgassmann/7b9bdd43b133c4f1067c9396dbb96668 to your computer and use it in GitHub Desktop.
FizzBuzz in Python
This file contains hidden or 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
| rules = { | |
| 3: 'Fizz', | |
| 5: 'Buzz' | |
| } | |
| for i in range(1, 1000): | |
| output = [rules[key] if i % key == 0 else '' for key in rules] | |
| output = ''.join(output) | |
| print(output if output != '' else i) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment