题解 | 重载运算
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,other):
return Coordinate(self.x+other.x,self.y+other.y)
list1 = [int(i) for i in input().split()]
list2 = [int(i) for i in input().split()]
c1 = Coordinate(list1[0],list1[1])
c2 = Coordinate(list2[0],list2[1])
c = c1.__add__(c2)
print(c.__str__())
快手公司福利 1244人发布