class Time: def __init__(self, hour, min): self.hour, self.min = hour, min def __str__(self): """overloading the str operator (STRing)""" return f"[ {self.hour:2d}:{self.min:2d} ]" def __repr__(self): """overloading the repr operator (REPResentation)""" return f"Time({self.hour:2d}, {self.min:2d})" def __gt__(self, other): """overloading the GreaterThan operator""" selfminutes = self.hour * 60 + self.min otherminutes = other.hour * 60 + other.min return selfminutes > otherminutes # %% if __name__ == "__main__": t1 = Time(15, 45) t2 = Time(10, 55) print(f"Informal string representation of the object t1: {str(t1)}") print(f"Representation of object = {repr(t1)}") print("compare t1 and t2: "), if t1 > t2: print("t1 is greater than t2")