CBSE Class 11 Computer Science Question 97 of 112

Dictionaries — Question 19

Back to all questions
19
Question

Question 13(b)

Predict the output

a = {'a':1, 'b':2, 'c':3}
print(a['a','b'])
Answer
Output
KeyError: ('a', 'b')  
Explanation

a is a dictionary containing three key-value pairs.
a['a','b'] will throw an error since given key ('a','b') is not present in dictionary a.