result = 0 arr = input("") score_weight = [int(n) for n in arr.split()] for i in range(1, len(score_weight)+1): result += i*score_weight[i-1] result_final = int((result/sum(score_weight))*10)/10 print(result_final)
python——加权平均问题,保留一位小数,且不四舍五入
最新推荐文章于 2023-06-10 02:17:54 发布