🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: Python Dictionaries: all 15 questions

Quiz: Python Dictionaries · Question 14 of 15

What does this print? (code)

What does this print?

student = {"name": "Ravi", "marks": {"maths": 88, "physics": 79}}
print(student["marks"]["physics"])
  1. A.{'maths': 88, 'physics': 79}
  2. B.88
  3. C.KeyError
  4. D.79
Answer & explanation

Correct answer: 79

The first key gives the inner dictionary; the second key reads a value inside it.

Can you get the rest right without peeking?

Take the timed Quiz: Python Dictionaries quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →