|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
print('------我爱老田-------')
temp = input("请输入1到100的数字:")
guess = int(temp)
times = 3
while (guess != 8) and times >0:
temp = input("继续猜:")
guess = int(temp)
times = times -1
if guess == 8:
print("你好牛逼啊!")
else:
if guess > 8:
print("大了")
else:
print("小了")
print("游戏结束!")
-------------------------------------------------------以上为我写的代码
------我爱老田-------
请输入1到100的数字:4
继续猜:5
小了
继续猜:6
小了
继续猜:9
大了
游戏结束!
>>>
------------------------------------------------以上为我的结果。
问题:
1.我希望三次以后结束循环,为什么4次?
2.红字部分为什么没有“大了”“小了”的提示?
感谢 |
|