|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
本帖最后由 hpv216 于 2017-12-7 12:06 编辑
我是用pycharm编写的,pycharm里可以运行 但是找到这个文件双击一闪就关闭了
电脑里我装了 python2.7 和3.6.3 默认是3.6.3
显示Non-ASCII character,我打开方式指向也是3.6.3的python.exe
我也加过 # -*- coding:utf8 -*-
显示No module named easygui
请问如何解决
import random
import easygui as g
g.msgbox("欢迎进入游戏")
num = random.randint(1, 10)
count = 3
msg = "你有%s次机会,猜数字(1-10):"
title = "猜数字小游戏"
guess = g.integerbox(msg % count, title, lowerbound=1, upperbound=10)
while count > 1:
if guess == num:
g.msgbox("猜对了")
break
else:
if guess > num:
g.msgbox("大了")
else:
g.msgbox("小了")
count -= 1
guess = g.integerbox(msg % count, title, lowerbound=1, upperbound=10)
if count == 1:
g.msgbox("都猜错了,你个弱鸡")
g.msgbox("游戏结束") |
|