ARTICLE AD BOX
#4
scores = [
[80,90,85],
[75,88,92],
[90,85,80],
[88,88,88]
]
max_avg = -1
best_index = 0
for i in range(len(scores)):
avg = sum(scores[i]) \ len(scores[i])
if avg > max_avg:
max_avg = avg
best_index = i
print(best_index)
I am trying to write a Python program that finds the index of the student with the highest average score.
Each row in the scores list represents a student, and each column represents a subject.
The program should calculate the average score for each student and print the index of the student with the highest average.
However, when I run the code, it does not work as expected. Can someone help me identify what is wrong?
