【发布时间】:2021-05-06 20:26:44
【问题描述】:
我想做一个策划游戏,我相信你们都知道它是什么,某种 GCSE 风格的 Python 猜数字游戏。它应该要求您输入一个数字,选择一个数字,然后告诉您是否猜对了,但我可能无法将随机选择的数字分配给“x”。
如您所见,我对 python 还是很陌生。
numberseasy = ['1244', '1354', '2355', '2366', '2609', '0010', '1234', '8873', '7775', '2512', '0293', '9463', '9901',
'6272', '0629']
numbershard = ['25356', '86025', '67390', '96873', '01255', '77654', '96756', '88742', '09564', '12345', '19455',
'35656', '20967', '32570']
print("welcome to mastermind!")
gamemode = input("please select gamemode: easy, hard")
if gamemode == "easy":
(random.choice(numberseasy)) = x
print("easy was selected")
print("im thinking of a number, try to guess a one digit integer each time to work out the number im thinking of i")
print("will tell you if you have one correct")
first = input("please enter a number")
【问题讨论】: