Last active
November 15, 2019 01:15
-
-
Save cacapon/f13044b1fc6f44f526c75b1ba5db41d1 to your computer and use it in GitHub Desktop.
修正1
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
# 名前をしっかりつける | |
START_NUM = 1 | |
END_NUM = 30 | |
def play_fizzbuzz(): | |
str_list = ['fizz', 'buzz', 'fizzbuzz'] | |
# 指定の数値その1から指定の数値その2まで繰り返す | |
for count in range(START_NUM,END_NUM+1): | |
# countが15だったら | |
if count % 15 == 0: | |
print("{}:{}".format(count,str_list[2])) | |
# countが3だったら | |
elif count%3==0: | |
print("{}:{}".format(count, str_list[0])) | |
# countが5だったら | |
elif count %5 == 0: | |
print("{}:{}".format(count, str_list[1])) | |
else: | |
print("{}:".format(count)) | |
play_fizzbuzz() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment