Ad
  • Custom User Avatar

    For the eq method, you're already representing the fractions in their most simplified form, so isn't it enough to just compare the self.top with other.top, and simmilarly for bottom?

    i.e. return self.top == other.top and self.bottom == other.bottom

  • Custom User Avatar

    I know writing this is a great exercise!
    But it is already available in the Python standard library (from fractions import Fraction)