import math class Rational: def __init__(self, p, q): self.p = p self.q = q self.normalize() def normalize(self): gcd = math.gcd(self.p, self.q) # ... def __add__(self, other): pass # return Rational(..., ...) def __sub__(self, other): pass # return Rational(..., ...) def __mul__(self, other): pass # return Rational(..., ...) def __truediv__(self, other): pass # return Rational(..., ...) def __repr__(self): pass # return f"..."