QuestionQ68

VerifiedData Collections – Tuples, Dictionaries, Lists, and Strings

What is the anticipated output of the following code?

Question Image

Explanation

The expression data['a', 'b'] creates the tuple key ('a', 'b'). Because that key is not present in the dictionary, Python raises a KeyError.

Community Discussion

No comments yet. Be the first to start the discussion!