day6-作业

  1. 5个人的成绩
    三科:语文、数学、英语
    求每个人的平均分
    求每科的平均分
grades = [[90, 89, 81], [89, 75, 84], [99, 95, 90], [76, 62, 80], [89, 95, 100]]
for i in range(len(grades)):
    sum1 = 0
    for score in grades[i]:
        sum1 += score
    average1 = sum1 / 3
    print(f'第{i + 1}个人的平均分:{average1:.1f}')
subject = ['语文', '数学', '英语']
for j in range(3):
    sum2 = 0
    for i in range(len(grades)):
        sum2 += grades[i][j]
    average2 = sum2 / 5
    print(f'{subject[j]}的平均分:{average2}')

你可能感兴趣的:(python,python)