# 1。电脑出拳,随机出拳1-3
import random
import easygui
answer = easygui.buttonbox("你敢跟老八猜拳吗?",
choices=("敢", "不敢"))
if answer == "敢":
win = 0
lose = 0
draw = 0
for i in range(1):
computer = random.randint(1, 3) # 数字
# 2。我们出拳
we = easygui.enterbox("你想出什么")
# we = input("你想出什么") # 字符串
we = int(we)
# 3。判断
result = computer - we
if 1 <= we <= 3: # we<1 或者 we >3
if computer - we == -1 or computer - we == 2:
easygui.msgbox("胜利")
win = win + 1
elif computer - we == 1 or computer - we == -2:
easygui.msgbox("lose")
lose = lose + 1
elif computer - we == 0:
easygui.msgbox("平局")
draw = draw + 1
if computer == 1:
easygui.msgbox("电脑出了石头")
elif computer == 3:
easygui.msgbox("电脑出了剪刀")
elif computer == 2:
easygui.msgbox("电脑出了布")
else:
easygui.msgbox("错误")
# 功能升级:战绩显示
easygui.msgbox("你赢了"+str(win)+"局")
easygui.msgbox("你真蔡"+lose+"局")
easygui.msgbox("平局"+draw+"局")
elif answer == "不敢":
easygui.msgbox("我*****")
Avanzada dedo-juego de adivinanzas aden -easgui
Supongo que te gusta
Origin blog.csdn.net/houlaos/article/details/105229270
Recomendado
Clasificación