题解 | #重载运算#
重载运算
https://www.nowcoder.com/practice/342d1b8b0fe3416797bad62d22cbb51a
class Coordinate: def __init__(self,x,y) -> None: self.x=x self.y=y def __str__(self) -> str: return f"({self.x}, {self.y})" def __add__(self,p): return Coordinate(self.x+p.x,self.y+p.y) x,y = list(map(lambda i:int(i), input().split(' '))) p1 = Coordinate(x,y) x,y = list(map(lambda i:int(i), input().split(' '))) p2 = Coordinate(x,y) p3 = p1+p2 print(str(p3))