用户:
恬静的金冠泥GUGF查看:66 回复:0 评论:0 创建时间:2020-08-11T13:08:41
【作品展示】

【作品介绍】
输入0-n的数字
【作品源代码】
import random
import time
scorn = 0
print('欢迎使用codemao 加法智能出题器')
x = int(input('请输入你想要挑战的加法范围,例如:0—100(输入100)'))
print('您已经选择0—', x, '的范围')
print('挑战马上开始,请在5秒内作答!')
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 >= 5):
print('对不起,您已超时')
break
else:
if (answer == a + b):
print('回答正确')
scorn = (scorn + 1)
else:
print('回答错误')
break
title = ''
if (x <= 10 and scorn >= 6):
title = '白银小将'
elif (x <= 50 and scorn >= 7):
title = '黄金大师'
elif (x <= 100 and scorn >= 8):
title = '荣耀宗师'
elif (x <= 100 and scorn >= 9):
title = '至尊王者'
else:
pass
print('获得的称号是', title)
【提示】
部分含有Python第三方库相关内容的作品,在海龟编辑器网页端无法运行哦!如遇到这种情况,可以打开下面的链接,下载海龟编辑器客户端:
https://python.codemao.cn