学习第四课了 记录一下 有错误地方 望指点
import randomsecret = random.randint(1,10)
temp = input('请输入你猜测的数字:')
guess = int(temp)
cishu = 1
while (guess != secret) and (cishu < 3):
if guess > secret:
print('你猜错了,大了!')
temp = input('请重新输入:')
guess = int(temp)
else:
print('你猜错了,小了!')
temp = input('请重新输入')
guess = int(temp)
cishu = cishu + 1
if (cishu < 3) or (guess == secret):
print('恭喜你答对了!')
else:
print('你猜测的次数太多了,请下次再试!')
页:
[1]