__str__, __repr__, __eq__ and __hash__
QuizMediumPython only
The double-underscore names are special methods (dunder methods) that Python calls for you. Class P defines __str__, __repr__ and __eq__ (comparing a field) but not __hash__. Which statements are true? Pick all that apply.
print(p)uses__str__print([p])uses__repr__for the item{P(1)}works and holds one objectP(1) == P(1)is True whileP(1) is P(1)is False
This question is part of Pro+
Pro+ opens every question in Interview Prep and the mock interview. Every article and the first 2 questions of each topic stay free. Hands-on Selenium and API tasks follow their course lesson's own lock.