You overrode __eq__ on a Money class, and when you tried to put an object in a set, you got TypeError: unhashable type. Why did this happen, and how do you correctly implement equality and hashing?
~4 min by voice
How to approach it
This checks your understanding of the hashing protocol in Python: why __eq__ without __hash__ makes an object unhashable, what contract connects equality and the hash, and why set and dict keys must be immutable.
The interviewer will ask this question and listen. Think out loud and ask for a hint if you need one. When you're done, pause or tap “That's my answer”. In about a minute, your score and the points you covered show up here.