Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save fumiya-kume/23ec6d2433560ae5d5fd0fef06b9e6fa to your computer and use it in GitHub Desktop.
Save fumiya-kume/23ec6d2433560ae5d5fd0fef06b9e6fa to your computer and use it in GitHub Desktop.
小籠包FizzBuzz
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