猫史档案馆


【Python作品分享】弹窗游戏【作业帖】

用户:羽瑶_SunnyCat羽瑶_SunnyCat查看:0 回复:2 评论:0 创建时间:2022-07-26T21:25:07


【作品展示】

center_image

 

【作品介绍】

更新!!!

每个玩法多加了两个游戏,有分数机制啦!

 

【作品源代码】

import easygui as g
score = 0
a = g.buttonbox(
    msg="Do you want to play any games?Let's go!",
    title="Play Games",
    choices=["Yes","No"]

)
if a == "Yes":
    b = g.choicebox(
        msg="What do you want to play?",
        title="Choice A Game",
        choices=["Guess riddles","Judgea sentence"]
    )
    if b == "Guess riddles":
        c = g.enterbox(
            msg="What animal wears big black glasses on its face?",
            title="Guess riddles"
        )
        if c == "panda":
            g.msgbox(
                msg="Yes,you are right!"
            )
            score = score + 1
        else:
            g.msgbox(
                msg="No,you are wrong!The correct answer is:panda"
            )
        e = g.enterbox(
            msg="My eyes like a cat and my tail like a cat too,but I'm not a cat.What am I? "
        )
        if e == "tiger":
            g.msgbox(
                msg="Yes,you are right!"
            )
            score = score + 1
        else:
            g.msgbox(
                msg="No,you are wrong!The correct answer is:tiger"
            )
        j = g.enterbox(
            msg="I look like a dog.But people and animals are all afraid of me,because I like eating them. "
        )
        if j == "wlof":
            g.msgbox(
                msg="Yes,you are right!"
            )
            score = score + 1
        else:
            g.msgbox(
                msg="No,you are wrong!The correct answer is:wlof"
            )

        print("Your score is ", score)

        
    if b == "Judgea sentence":
        d = g.choicebox(
            msg="Snake don't have spines.",
            title="Judgea sentence",
            choices=["Yes","No"]
        )
        if d == "No":
            g.msgbox(
                msg="Yes,you are right!"
            )
            score = score + 1
        if d == "Yes":
            g.msgbox(
                msg="No,you are wrong!The correct answer is:No"
         )
        
        f = g.choicebox(
            msg="Foxes have many colors.",
            title="Judgea sentence",
            choices=["Yes", "No"]
        )
        if f == "Yes":
            g.msgbox(
                msg="Yes,you are right!"
            )
            score = score + 1
        if f == "No":
            g.msgbox(
                msg="No,you are wrong!The correct answer is:Yes"
            )
        h = g.choicebox(
            msg="Cats can climb trees.",
            title="Judgea sentence",
            choices=["Yes", "No"]
        )
        if h == "Yes":
            g.msgbox(
                msg="Yes,you are right!"
            )
            score = score + 1
        if h == "No":
            g.msgbox(
                msg="No,you are wrong!The correct answer is:Yes"
            )
        print("Your score is ",score)
        
else:
    g.msgbox(
        msg="OK.Bye!"
    )

 

【提示】

部分含有Python第三方库相关内容的作品,在海龟编辑器网页端无法运行哦!如遇到这种情况,可以打开下面的链接,下载海龟编辑器客户端:

https://python.codemao.cn


回复

上一页1 页 / 共 1下一页
羽瑶_SunnyCat羽瑶_SunnyCat

看得我眼花imgsrc="https://static.codemao.cn/emoji/codemao/%E7%BC%96%E7%A8%8B%E7%8C%AB_%E6%BA%9C%E4%BA%86%E6%BA%9C%E4%BA%86.gif"alt="emotion_编程猫_溜了溜了"

点赞0


评论


忠厚的暴风雀c2j_忠厚的暴风雀c2j_

编程猫社区-回忆小学-少儿编程作品(codemao.cn)  

点赞0


评论