首页 > 解决方案 > 拼写测试分级机

问题描述

我正在编写一个对拼写蜜蜂单词测试进行评分的代码,下面有我的代码。当我输入代码时它可以工作,但输出只是给了我一个数字,这很好,但我如何将它更改为字母等级而不是数字?

def how_eligible(essay):
    total = int(0)
    if 'hyperactive' in essay:
        total += int(1)
    if  'chrysanthemum' in essay:
        total += int(1)
    if 'onomatopoeia' in essay:
        total += int(1)
    if 'aardvark' in essay:
        total += int(1)
    if 'magnanimity' in essay:
        total += int(1)
    return total

标签: pythonpython-3.x

解决方案


推荐阅读