Trương Duy Bằng
New member
What will be the output of the following Python code?
A. False
B. 1
C. True
D. An exception is thrown
Code:
class A:
def __init__(self, x, y):
self.x = x
self.y = y
def __str__(self):
return 1
def __eq__(self, other):
return self.x * self.y == other.x * other.y
obj1 = A(5, 2)
obj2 = A(2, 5)
print(obj1 == obj2)
B. 1
C. True
D. An exception is thrown