設(shè)計一個一維數(shù)組存放10個學(xué)生成績求出平均分、最高分和最低分,在主函數(shù)中顯示平均分、最高分和最低分?運行結(jié)果示例: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條經(jīng)驗 獲得超8個贊
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
提交
取消