The program calculates the student average incorrectly.
- Open the Student Marks Management System.
- Run the Python program.
- Check the average displayed for Manasa.
- Compare the displayed average with the manually calculated average.
The program displays an average of 109.0 for Manasa.
The program should display an average of 87.2.
The program divides the total marks by 4 instead of the actual number of subjects, which is 5.
average = total / 4The total and average values were inspected during execution to identify the incorrect divisor.
Identified — Not Fixed Yet.
The hardcoded divisor was replaced with len(marks) to calculate the average based on the actual number of subjects.
total = sum(marks)
average = total / len(marks)Input: Manasa's marks = 85, 90, 78, 88, 95
Expected average: 87.2 Actual average after fix: 87.2
Result: PASS
Using len(marks) makes the program flexible. If the number of subjects changes, the average calculation will still work correctly.
The loop range was corrected to include every student in the list.
for i in range(len(students)):Input: Three students in students.txt.
Expected result: All three students should be displayed.
Actual result: Manasa, Rahul and Ananya were displayed.
Result: PASS
The corrected loop processes every valid student index, including the last student.