← 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"])
- A.{'maths': 88, 'physics': 79}
- B.88
- C.KeyError
- 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 →