Question OOP-POLY-0046
MediumWhat is the output of this code?
class M:
def __init__(self, v): self.v = v
def __add__(self, o): return M(self.v * o.v)
def __eq__(self, o): return self.v == o.v
print((M(2) + M(3)).v, M(6) == M(2) + M(3))
- A.
5 True
- B.
6 False
- C.
Sign up free to see the answer and a step-by-step explanation.