猫史档案馆


【Python作品分享】数学挑战【作品秀】

用户:TianYCTianYC查看:1 回复:1 评论:1 创建时间:2022-05-27T20:09:04


【作品展示】

center_image

 

【作品介绍】

随便玩玩

学而思C站用不了了

 

【作品源代码】

import easygui as g
score = 0
q_list=["10+10=?\nA.20 B.100 C.0","100×100=?\nA.200 B.0 C.10000","3的平方是?A.6 B.9 C.3","5的立方是?A.25 B.15 C.125","1、2、4、8……这么变化下去,第15个数字是?A.30 B.196 C.225"]
a_list=["A","C","B","C","B"]
for i in range(len(q_list)):
    q = q_list[i]
    a = a_list[i]
    g1 = g.enterbox(q)
    if g1 == a:
        g.msgbox(msg="你答对了",title="答对了")
        score = score + 1
    else:
        g.msgbox(msg="你答错了",title="答错了")
    i = i + 1
if len(q_list) == score:
    g.msgbox(msg="恭喜你,答对了所有的题目\n你答对了"+str(score)+"道题",title="你答对了所有的题",ok_button="好的")
ds = round(score/len(q_list),3)
if ds >= 0.8 and ds < 1:
    g.msgbox(msg="你答对了大部分题目\n你答对了"+str(score)+"道题", title="可以啦!",ok_button="好的")
if ds > 0.5 and ds < 0.8:
    g.msgbox(msg="你答对了大约一半题目\n你答对了"+str(score)+"道题", title="还行吧", ok_button="好的")
if ds <= 0.5:
    g.msgbox(msg="你答对了少部分题目\n你答对了"+str(score) +"道题", title="加油哦", ok_button="好的")

 

【提示】

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

https://python.codemao.cn


回复

上一页1 页 / 共 1下一页
我是伊柒我是伊柒

点赞,猫站就是需要用户创作

点赞0


评论