发布时间:2019-07-31 09:40:57编辑:auto阅读(1630)
# -*- coding:utf-8 -*- import easygui,random status = easygui.buttonbox("这是一个猜数字游戏,点击开始进行游戏,点击退出关闭游戏。", choices = ["开始","退出"]) if status == "开始": s_number = random.randint(1,100) count = 0 u_number = 0 #print s_number while count < 6 and u_number != s_number: u_number = int(easygui.enterbox("请输入一个1-100的数字:")) if u_number == s_number: easygui.msgbox("恭喜你猜对了") break elif u_number < s_number: easygui.msgbox("小了") #print u_number else: easygui.msgbox("大了") #print u_number count = count + 1 else: easygui.msgbox("六次了你都没有猜中") #print s_number else: easygui.msgbox("退出游戏!") #print "exit"
上一篇: Dive into python
下一篇: H3CTE讲师分享H3C认证培训实验实验
47490
45792
36789
34321
28958
25594
24441
19608
19109
17630
5463°
6046°
5568°
5636°
6571°
5374°
5375°
5882°
5853°
7167°