Last active
September 3, 2020 15:18
-
-
Save kotoripiyopiyo/18c45f95706eda78f88d84df6cf153dc to your computer and use it in GitHub Desktop.
数当てゲーム(全部自分で考えて書いた)
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
import random | |
oknumber = random.randint(1,10) | |
n = 1 | |
print('1から10までの数を当ててください') | |
while oknumber != inputnumber: | |
inputnumber = int(input('数を入力してください:')) | |
if oknumber > inputnumber: | |
print('小さすぎます') | |
n += 1 | |
elif oknumber < inputnumber: | |
print('大きすぎます') | |
n += 1 | |
elif oknumber == inputnumber: | |
print('当たり!' + str(n) + '回で当てました!') | |
break |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment