Q. What is the output of the following code?
Code:
class Point:
def __init__(self, x = 0, y = 0):
self.x = x
self.y = y
def __sub__(self, other):
x = self.x + other.x
y = self.y + other.y
return Point(x,y)
point1 = Point(30, 40)
point2 = Point(10, 20)
point3 = point1 - point2
print(point3.x, point3.y)
β
Correct Answer: (B)
40 60