# вычисление средней оценки каждого предмета всех учеников
count_students = len(temp_2d_list)
count_school_subjects = len(temp_2d_list[0])
for col in range(count_school_subjects):
for row in range(count_students):
sum_row += float(temp_2d_list[row][col])
average = sum_row / len(temp_2d_list)
sum_row = 0
print(str(average), end=' ')
outfile.write(str(average) + ' ')