猫史档案馆


【Python作品分享】随机加法练习【作业帖】

用户:EmpowerAllEmpowerAll查看:45 回复:0 评论:0 创建时间:2020-02-03T14:22:26


【作品展示】

center_image

 

【作品介绍】

1到100加法

 

【作品源代码】

import random


score = 0
for __count in range(10):
    a = random.randint(1, 100)
    b = random.randint(1, 100)
    c = (a + b)
    print('a=', a)
    print('b=', b)
    d = input('a+b=?')
    if (d == c):
        score += 1
        print('right.', 'score=', score)
    else:
        score -= 1
        print('wrong', 'score=', score)

 

【提示】

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

https://python.codemao.cn


回复

上一页第 1 页 / 共 0 页下一页