10,905
社区成员




class app:
def __init__(self, num, den) -> None:
self.num = num
self.den = den
def plus(self, another):
self.den = self.den * another.den
self.num = self.den * another.num + another.den * self.num
return app(self.num, self.den)
ap = app(2, 3)
another = app(4, 5)
ap = ap.plus(another)
print(ap.num, ap.den)