Created
June 26, 2021 05:36
-
-
Save t0yohei/f456896edf33154e41747d61bea993a6 to your computer and use it in GitHub Desktop.
fizzbuzz program without any `if`, `while`, `for` and relational operators such as `==`.
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
THREE_HASH = {0: "fizz", 1: "", 2: ""} | |
FIVE_HASH = {0: "buzz", 1: "", 2: "", 3: "", 4: "", 5: ""} | |
def fb(i): | |
result = "" | |
result += THREE_HASH[i % 3] | |
result += FIVE_HASH[i % 5] | |
return result | |
i = 1 | |
while i <= 200: | |
print(i, fb(i)) | |
i = i + 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment