QuestionQ260

VerifiedData Collections – Tuples, Dictionaries, Lists, and Strings

What output is expected from the code below?

Question Image

Explanation

A dictionary cannot be used as a key in another dictionary because dictionaries are unhashable. Evaluating crates[box] therefore raises a TypeError, so the code is erroneous.

Community Discussion

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