Created
May 18, 2025 23:13
-
-
Save fumiya-kume/23ec6d2433560ae5d5fd0fef06b9e6fa to your computer and use it in GitHub Desktop.
小籠包FizzBuzz
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
def xiaolongbao_fizzbuzz(start: int, end: int) -> None: | |
""" | |
start から end までの数字をループし、 | |
3の倍数は '小籠'、5の倍数は '包'、 | |
両方の倍数は '小籠包' を出力します。 | |
""" | |
for current_number in range(start, end + 1): | |
if current_number % 15 == 0: | |
print("小籠包") | |
elif current_number % 3 == 0: | |
print("小籠") | |
elif current_number % 5 == 0: | |
print("包") | |
else: | |
print(current_number) | |
if __name__ == "__main__": | |
xiaolongbao_fizzbuzz(1, 100) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment