kor_score = [49, 79, 20, 100, 80]
math_score = [43, 59, 85, 30, 90]
eng_score = [49, 79, 48, 60, 100]
midterm_score = [kor_score, math_score, eng_score]
print(midterm_score)
print(midterm_score[0])
print(midterm_score[0][3])

# student_score = [0, 0, 0, 0, 0]
# for i in range(3):
#     for j in range(5):
#         student_score[j] += midterm_score[i][j]
#         print(student_score)
# else :
#     for k in range(5):
#         print(f'평균은 {student_score[k]/3} 입니다.')


student_score = [0, 0, 0, 0, 0]
idx = 0
for subject in midterm_score:
    # 학생별 과목합계 점수를 계산
    for score in subject:
        student_score[idx] += score
        idx += 1
    # 과목이 바뀔 때 학생 인덱스 초기화
    idx = 0
else:
    # 평균을 계산(unpacking사용)
    print(f'학생별 합계점수 {student_score}')
    a, b, c, d, e = student_score
    student_average = [int(a/3), int(b/3), int(c/3), int(d/3), int(e/3)]
    print(f'학생별 평균점수 = {student_average}')
