Python easyGUI 猜数字

import easygui as g
import random

d=random.randint(0,10)

while 1:

    g.msgbox("现在开始猜数字小游戏:")
   # num=int(g.enterbox(title='猜我心里在想哪个数字'))

    msg="我心里在想哪个数字"
    title='玩游戏'
    num=g.integerbox(msg,title,lowerbound=0,upperbound=99)
    if num==d:
        g.msgbox("牛逼")
        break
    elif num>d:
        g.msgbox('大了')
    else:
        g.msgbox('小了')

 

posted @ 2018-01-30 19:11  张老师的小黑屋  阅读(369)  评论(0编辑  收藏  举报