Implement Rational(num, den=1) without the fractions module:
Rational(2, -4) is -1/2); a zero denominator raises ZeroDivisionError+ - * / with other Rationals and ints (both sides), unary -, abs==, < (and the other comparisons via functools.total_ordering), hash consistent with equality (Rational(2, 1) == 2 and they hash the same)str → "3/4", or just "3" when the denominator is 1; float(r)