标签:python import status 游戏 count
# -*- 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"
本文出自 “浪漫的偷笑” 博客,请务必保留此出处http://lmdtx.blog.51cto.com/6942028/1610849
标签:python import status 游戏 count
原文地址:http://lmdtx.blog.51cto.com/6942028/1610849