问题遇到的现象和发生背景
while True:在条件设置中,True的T能用小写字母吗?这个True条件,什么时候跳出循环
问题相关代码,请勿粘贴截图
>>> import random
>>> import easygui as eg
>>> eg.msgbox("欢迎来到猜数字游戏世界!!!")
'OK'
>>> eg.msgbox("欢迎来到猜数字游戏世界!!!",ok_button = "继续")
'继续'
>>> da = random.randint(1,100)
>>> m = eg.integerbox(msg = "请输入你猜测的数字",title = "猜一猜",lowerbound = 1,upperbound = 100)
>>> while True:
if da == m:
eg.msgbox("猜对啦,你是我肚子里的蛔虫吗?")
eg.msgbox("哼!猜对也没有奖励!")
else:
if da > m:
eg.msgbox("小了,小了")
else:
eg.msgbox("大了,大了")
m = eg.integerbox(msg = "请再次输入你猜测的数字",title = "猜一猜",lowerbound = 1,upperbound = 100)
>>>eg.msgbox("游戏结束,不玩啦!!")