AttributeError:“ dict”对象没有属性“ value”。我不知道为什么

时间:2018-11-12 04:13:17

标签: python

korean, english, mathematics, science = map(int, input().split())
def get_min_max_score(*args):
    return min(args),max(args)
def get_average(**kwargs):
    return float(sum(kwargs.value())/len(kwargs))


min_score, max_score = get_min_max_score(korean, english, mathematics, science)
average_score = get_average(korean=korean, english=english, mathematics=mathematics, science=science)
print('min: {0:.2f}, max: {1:.2f}, average: {2:.2f}'.format(min_score, max_score, average_score))

min_score, max_score = get_min_max_score(english, science)
average_score = get_average(english=english, science=science)
print('min: {0:.2f}, max: {1:.2f}, average: {2:.2f}'.format(min_score, max_score, average_score))

1 个答案:

答案 0 :(得分:0)

您要将value函数中的get_average替换为values