用户:
极限小白查看:0 回复:2 评论:0 创建时间:2020-03-17T16:43:30
【作品展示】

【作品介绍】
哈哈哈
【作品源代码】
import random as e
import easygui as g
import random
import time
def 首页():
hhh = g.buttonbox("请问你想玩什么呢?", title="猜拳", choices=("口算", "猜拳", "不玩了"))
if (hhh == "口算"):
计算()
if (hhh == "猜拳"):
猜拳()
def 计算():
b = random.randint(1, 100)
c = random.randint(1, 10)
d = 1
e = random.randint(1, 4)
if (e == 1):
print(b, '+', c, +'=', '?')
f = int(input(''))
while (d == 1):
if (f == b + c):
print('恭喜你,答对了')
time.sleep(1)
d = 0
else:
print('很遗憾,答错了')
print(b, '+', c, '=', '?')
f = int(input(''))
elif (e == 2):
print(b, '-', c, '=', '?')
f = int(input(''))
while (d == 1):
if (f == b - c):
print('恭喜你,答对了')
time.sleep(1)
d = 0
else:
print('很遗憾,答错了')
print(b, '-', c, '=', '?')
f = int(input(''))
elif (e == 3):
print(b, '×', c, '=', '?')
f = int(input(''))
while (d == 1):
if (f == b * c):
print('恭喜你,答对了')
time.sleep(1)
d = 0
else:
print('很遗憾,答错了')
print(b, '×', c, '=', '?')
f = int(input(''))
else:
print(b, '÷', c, '=', '?')
f = float(input(''))
while (d == 1):
if (f == b / c):
print('恭喜你,答对了')
time.sleep(1)
d = 0
else:
print('很遗憾,答错了')
print(b, '÷', c, '=', '?')
f = float(input(''))
首页()
def 猜拳():
a = g.buttonbox("请选择剪刀、石头或布,与电脑猜拳吧!", title="猜拳",choices=("剪刀", "石头", "布"))
b = e.randint(1, 3)
g.msgbox("你选择了"+a+",你确定吗?", title="猜拳", ok_button="确定")
if (a == "剪刀"):
c = 1
if (a == "石头"):
c = 2
if (a == "布"):
c = 3
int(c)
if (b == 1):
if (c == 1):
g.msgbox("电脑出的和你一样,这一局,平了!", title="猜拳", ok_button="好的")
首页()
if (c == 3):
g.msgbox("电脑出剪刀,这一局,电脑赢了!", title="猜拳", ok_button="好的")
首页()
if (c == 2):
g.msgbox("电脑出剪刀,这一局,你赢了!", title="猜拳", ok_button="好的")
首页()
if (b == 2):
if (c == 2):
g.msgbox("电脑出的和你一样,这一局,平了!", title="猜拳", ok_button="好的")
首页()
if (c == 1):
g.msgbox("电脑出石头,这一局,电脑赢了!", title="猜拳", ok_button="好的")
首页()
if (c == 3):
g.msgbox("电脑出石头,这一局,你赢了!", title="猜拳", ok_button="好的")
首页()
if (b == 3):
if (c == 3):
g.msgbox("电脑出的和你一样,这一局,平了!", title="猜拳", ok_button="好的")
首页()
if (c == 2):
g.msgbox("电脑出布,这一局,电脑赢了!", title="猜拳", ok_button="好的")
首页()
if (c == 1):
g.msgbox("电脑出布,这一局,你赢了!", title="猜拳", ok_button="好的")
首页()
首页()
【提示】
部分含有Python第三方库相关内容的作品,在海龟编辑器网页端无法运行哦!如遇到这种情况,可以打开下面的链接,下载海龟编辑器客户端:
https://python.codemao.cn