学生成绩最大值、最小值,平均分

博客围绕Python开发语言展开,但具体内容缺失。Python是一种广泛应用的后端开发语言,在数据处理、人工智能等领域有诸多应用。
def student_score():
    scores = []
    with open("student_score.txt", encoding="utf8") as fin:
        for line in fin:
            line = line.strip()
            fields = line.split(",")
            scores.append(int(fields[-1]))
    max_score = max(scores)
    min_score = min(scores)
    avg_score = round(sum(scores) / len(scores), 2)
    return max_score, min_score, avg_score

max_score, min_score, avg_score = student_score()
print("最高分:" + str(max_score) + "\n" + "最低分:" + str(min_score) + "\n" + "平均分:" + str(avg_score))

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值