Computer Science
In no more than one sentence, explain the following Python error and how it could arise:
TypeError: unhashable type: 'list'
Python Dictionaries
9 Likes
Answer
This type of error occurs when a mutable type like list is used as a key in dictionary — d1 = {[4, 5] : "a"}
Answered By
4 Likes
Related Questions
What all types of values can you store in :
- dictionary-values ?
- dictionary-keys ?
Can you change the order of dictionary's contents, i.e., can you sort the contents of a dictionary ?
Dictionary is a mutable type, which means you can modify its contents ? What all is modifiable in a dictionary ? Can you modify the keys of a dictionary ?
Can you check for a value inside a dictionary using in operator? How will you check for a value inside a dictionary using in operator ?