Intern — Junior
What is used as a key in a dictionary data structure?
sobes.tech AI
Answer from AI
In Python, in a dictionary (dict), the key must be an object that is hashable (immutable and with a defined __hash__ method). This means keys should be of immutable data types like strings, numbers, tuples (if all elements are hashable). For example, a list cannot be a key because it is mutable and not hashable.