This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
# 计算每个人的总分,排序并输出
# 1)增加一个总分列 2)按总分降序排序 3)输出学号、姓名、总分
score=[["101","Mary",80,85,90],
["102","Rose",80,90,95],
["103","Mike",75,72,65],
["104","Peter",65,63,58],
["105","Harry",95,93,88]]
for i in range(5):
zf=score[i][2]+score[i][3]+score[i][4]
score[i].append(zf)
score=sorted(score,key=lambda k:k[5],reverse=True)
print("学号{}姓名{}总分{}".format(score[i][0],score[i][1],score[i][5]))