xingtai -超级猜拳

import easygui
import random # 随机工具包
for s in range(3):
    c = random.randint(1,3) # 随机产生1-3的数字
    if c==1:
        quantou = "石头"
    elif c==2:
        quantou="布"
    elif c==3:
        quantou="剪刀"
    # print("电脑出的是:"+quantou)
    # # msgbox用窗口显示文字
    # easygui.msgbox("电脑出的是:"+quantou)
    # easygui.enterbox用窗口输入文字
    we = easygui.enterbox("请出拳头(石头,剪刀,布)")
    if we=="石头":
        I = 1
    elif we=="剪刀":
        I=3
    elif we=="布":
        I=2
    easygui.msgbox("战斗过程:\n\n电脑出的是:%s \n我出的是:%s"%(quantou,we))
    c2 = c - I
    if c2 == -1 or c2 == 2:
        easygui.msgbox("6666,大佬真厉害")
    elif c2 == -2 or c2 == 1:
        easygui.msgbox("你lose了")
    elif c2 == 0:
        easygui.msgbox("再接再励")
发布了254 篇原创文章 · 获赞 16 · 访问量 9515

猜你喜欢

转载自blog.csdn.net/houlaos/article/details/103947176
今日推荐