程序 顺序执行

程序不应该是顺序执行的吗?在如下代码中,不明白为什么不是先打出count的值,而是直接调用easygui的integerbox。

import random as r
import easygui as g

# 生成随机数
hnum = r.randint(1,10)
'''
def judge_type(temp):
    while not(temp.isdigital()):
        temp = input('The number you input is wrong,try again!!!')
'''

# 就像堆积木一样,可以调用简单的图形化窗口,但是如果涉及其中的值的传递便瞎了。
input = g.integerbox('Input the number that is in my heart(1-10):',\
                     title = 'wordGameGUI',lowerbound = 1,upperbound = 10)    
count = 1

while 1:
	#测试代码区域。
    print(count)
    if count > 3:
            g.msgbox('Time out!!!')
            break
    if hnum != input:
        
        if hnum > input:
            g.msgbox('Small!!!')
            input = g.integerbox('Input the number that is in my heart(1-10):',\
                     title = 'wordGameGUI',lowerbound = 1,upperbound = 10)
        else:
            g.msgbox('Bigger!!!')
            input = g.integerbox('Input the number that is in my heart(1-10):',\
                         title = 'wordGameGUI',lowerbound = 1,upperbound = 10)
        
    else:
        g.msgbox('You are right!!')
        break
    
    count += 1

在我执行的多次结果中,总是先执行EasyGUI的模块,然后再打印出count的值。这个顺序不太明白。
在这里插入图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值