Average Marks by Subject
Given a DataFrame of student marks across 3 subjects, calculate the class average for each subject.
Why not the chart? the notes visualize this with a Seaborn bar chart, but an automated judge can only grade text output, not a rendered image — this problem tests the underlying data computation (the class average per subject) that would actually feed that chart.
Approach: build a DataFrame with maths/science/english columns, then take the mean of each column.
Input: First line: the number of students n. Next n lines: maths,science,english scores.
Output: Three lines: maths: <avg>, science: <avg>, english: <avg>, each to 2 decimal places.
5 85,78,90 45,55,60 92,88,85 38,42,50 76,81,70
maths: 67.20 science: 68.80 english: 71.00
- 1 <= n <= 1000
Hint 1
df[["maths", "science", "english"]].mean() computes the average of each column at once, returning one value per subject.
Hint 2
Loop over the three subject names in order and format each average with :.2f.
df[["maths", "science", "english"]].mean() computes the average down each column — the class average for each subject — in one call, no manual loop needed. This is exactly the numbers the notes' own sns.barplot() would visualize; printing them directly is the text-gradable equivalent of that chart.