Computer Science
Though tuples are immutable type, yet they cannot always be used as keys in a dictionary. What is the condition to use tuples as a key in a dictionary ?
Python Dictionaries
12 Likes
Answer
The tuple should contain only immutable entries. Only then it can be used as a key in a dictionary.
Answered By
7 Likes
Related Questions
What all types of values can you store in :
- dictionary-values ?
- dictionary-keys ?
Why is a dictionary termed as an unordered collection of object?
Can you change the order of dictionary's contents, i.e., can you sort the contents of a dictionary ?
What type of objects can be used as keys in dictionaries ?