lst_score = eval(input('输入分数列表:')) # 输入分数列表 max_score = max(lst_score) # 获取最高分 min_score = min(lst_score) # 获取最低分 lst_score.remove(max_score) # 删除最高分 lst_score.remove(min_score) # 删除最低分 count = len(lst_score) # 计算剩余分数个数 s = sum(lst_score) # 计算剩余分数总分 print('平均分:{:.1f}'.format(s / count)) # 输出平均分,结果保留一位小数

Python 程序:计算列表分数平均值(去除最高最低分)

原文地址: https://www.cveoy.top/t/topic/oj7a 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录