用户:ZCH_WHX查看:0 回复:1 评论:0 创建时间:2020-06-14T13:45:05
【作品展示】

【作品介绍】
一个加法出题器,来挑战一下吧!
【作品源代码】
import easygui
import random
import time
import codemao
print('欢迎使用CodeMao智能加法出题器v1.386.7')
print('作者:王浩轩')
if (easygui.ynbox('CodeMao智能加法出题器需要更新,更新时长未知,最多一分半钟。是否更新?') == 1):
t = random.randint(0, 90)
print('需等待:', t, '秒')
time.sleep(t)
if (easygui.ynbox('游戏已更新完毕,是否继续?退出的话将要重新更新!') == 1):
x = int(input('请输入你想挑战的加数范围,例如:0~100(输入100):'))
print('您已经选择0 ~', x, '的范围')
print('挑战马上开始,一共十题,每题请在10秒内作答!')
else:
image.close_image()
else:
image.close_image()
score = 0
for i in range(10):
print()
a = random.randint(0, x)
b = random.randint(0, x)
prompt = (((str(a) + '+') + str(b)) + '=?')
print(prompt)
start_time = time.time()
answer = int(input('请输入你的答案:'))
end_time = time.time()
if (end_time - start_time >= 10):
print('对不起,您已超时,答题无效!')
else:
if (answer == a + b):
print('恭喜您,回答正确!')
score = (score + 1)
else:
print('对不起,回答错误!')
title = '计算炮灰'
if (x <= 10 and score >= 4):
title = '热血青铜'
elif (x <= 30 and score >= 5):
title = '不屈白银'
elif (x <= 50 and score >= 6):
title = '英勇黄金'
elif (x <= 70 and score >= 7):
title = '不朽星钻'
elif (x <= 90 and score >= 8):
title = '超级王牌'
elif (x <= 100 and score >= 9):
title = '喵战神'
else:
pass
print('您的段位是:', title)
print('感谢使用本程序!')
【提示】
部分含有Python第三方库相关内容的作品,在海龟编辑器网页端无法运行哦!如遇到这种情况,可以打开下面的链接,下载海龟编辑器客户端:
https://python.codemao.cn