编写一个猜数的游戏程序。(数字由机器随机产生,限制为1~100之间的整数,用户输入猜测,程序给出大小提

2024-12-02 02:41:45
推荐回答(2个)
回答1:

from random import randint
num = randint(1,100)
count = 1
while True:
guess=int(raw_input('Enter a number: '))
count+=1
if count>10:
print "You fail. Answer: ",num
break
if guess>num:
print "Smaller"
elif guess print "Bigger"
else:
print "Got it"
break

Python.

回答2: