Skip to content
Programs · Program 3-4

Q.Write the python statement to print the total marks secured by Raman in each subject.

Yanam BieapTextbookSubjective· 2mImportance★★★★★
15% · 8/53 Questions
🔒 Locked · start free trial →

You're viewing a preview — the full solution, concept, methods & PYQ mapping are locked.

Start your 14-day free trial to unlock the full solution →

Filter to Raman's rows, then use .sum() on the subject columns (axis=0, the default) to total each subject across his three unit tests; .sum(axis=1) instead totals across subjects, one number per test.

dfRaman = df[df['Name'] == 'Raman']
dfRamanMarks = dfRaman[['Maths','Science','S.St','Hindi','Eng']]
print(dfRamanMarks.sum())          # total per subject
print(dfRamanMarks.sum(axis=1))    # total per unit test

Output:

Maths      57
Science    60
S.St       50
Hindi      66
Eng        68
dtype: int64 …

Unlock everything free for 14 days

  • Full step-by-step solutions
  • Concept-first explanations
  • Methods, shortcuts & mistakes
  • PYQ mapping + timed mock tests

Full access for 14 days. No credit card required.