设计一个一维数组存放10个学生成绩求出平均分、最高分和最低分,在主函数中显示平均分、最高分和最低分?运行结果示例:Input 10 scores:88 90 88 70 40 80 92 90 92 95AverScore = 82.5MaxScore = 95.0MinScore = 40.0输入提示信息:"Input 10 scores:\n"输入格式:"%f"输出格式:"AverScore = %.1f\nMaxScore = %.1f\nMinScore = %.1f\n"
1 回答
qq_遁去的一_1
TA贡献1725条经验 获得超7个赞
scores = []
for i in range(10):
score = float(input("Input score %d: " % (i+1)))
scores.append(score)
avg_score = sum(scores) / 10
max_score = max(scores)
min_score = min(scores)
print("AverScore = %.1f\nMaxScore = %.1f\nMinScore = %.1f\n" % (avg_score, max_score, min_score))
Input 10 scores:
88 90 88 70 40 80 92 90 92 95
AverScore = 82.5
MaxScore = 95.0
MinScore = 40.0
添加回答
举报
0/150
提交
取消