Loops 关于在python中猜数字游戏的查询?
我做了一个随机猜谜游戏,玩家必须猜出电脑给出的数字。但这里有个问题。当答案错误时,我会给出一个提示,但在获得提示后,如果不重新启动程序,该人员如何再次回答? 我的代码是:Loops 关于在python中猜数字游戏的查询?,loops,for-loop,while-loop,Loops,For Loop,While Loop,我做了一个随机猜谜游戏,玩家必须猜出电脑给出的数字。但这里有个问题。当答案错误时,我会给出一个提示,但在获得提示后,如果不重新启动程序,该人员如何再次回答? 我的代码是: n = [0,1,2,3,4,5,6,7,8,9] r = random.randint(0, 10) r2 = random.randint(3, 6) print(r) #this is the no. compputer gives guess = 8 #this is the
n = [0,1,2,3,4,5,6,7,8,9]
r = random.randint(0, 10)
r2 = random.randint(3, 6)
print(r) #this is the no. compputer gives
guess = 8 #this is the no. tht the player must guess
if guess == r:
print("Hurray u won!")
else:
print("U lost mfk!")
y = r*r2
print("The number is a factor of :" + str(y)) #clues```