|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
import easygui as g
import sys
secret = 7
while 1:
g.msgbox('Place','Guess number!')
msg = "不妨猜一下小甲鱼心里想的是哪个数字?"
title = 'Guessing Game'
g.enterbox(msg,title)
result = g.enterbox
g.msgbox(str(result),'Guessing Game')
if result == secret:
g.msgbox('Get it!','Guessing Game')
msg = "Do you want to start again?"
title = "Place select"
if g.ccbox(msg,title):
pass
else:
sys.exit(0)
想做一个猜数字小游戏,但是enterbox的返回值不是int的,所以不能和设置的值比较,不知道怎么改
- import easygui as g
- import sys
- secret = 7
- while 1:
- g.msgbox('Place','Guess number!')
-
- msg = "不妨猜一下小甲鱼心里想的是哪个数字?"
- title = 'Guessing Game'
-
- result = int(g.enterbox(msg,title))
- g.msgbox(result,'Guessing Game')
-
- if result == secret:
- g.msgbox('Get it!','Guessing Game')
- msg = "Do you want to start again?"
- title = "Place select"
- if g.ccbox(msg,title):
- pass
- else:
- sys.exit(0)
复制代码
|
|