Only immutable data types can be used as keys for dictionaries in Python. True or False?
Explanation
Any hashable object can be used as dictionary key, Immutable data types are subset of all hashable objects, but this relation is not exhaustive. For example, you can define your own class with a __hash__ method in it and use it as a dictionary key.

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback
Keep exploring
Python quizzes
Cosmo
Sign Up Now
or Subscribe for future quizzes