Created
May 26, 2016 17:34
-
-
Save dboyliao/331a196509e16a2bf4d6dbbe7285cdd6 to your computer and use it in GitHub Desktop.
Classic "Fizz Buzz" without "if-else"
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
from __future__ import print_function | |
def main(): | |
while True: | |
x = int(input("Please enter an integer: ")) | |
print([[[x, "Fizz"][x % 3 == 0], "Buzz"][x % 5 == 0], "FizzBuzz"][x % 15 == 0]) | |
if __name__ == "__main__": | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment