Q. What is output of the following code?
Code:
class A:
def __init__(self, x):
self.x = x
def __eq__(self, other):
return self.x == other.x
a = A(5)
b = A(5)
print(a == b)
β
Correct Answer: (A)
True
Explanation: `__eq__` method compares the values of `x` in both objects, so returns True.