Question library
Questions from real interviews. Drill any of them by voice in a couple of minutes, with an interviewer, a score and feedback.
What are magic, or dunder, methods in Python? What are they for? Give a few examples.JuniorYou 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?Mid-levelWhat happens when you override __eq__ in your class, and how does that relate to __hash__? How would you make an object that can safely be put in a set and used as a dictionary key?Senior