diff --git a/app/main.py b/app/main.py index b3659f66c..63966c8e6 100644 --- a/app/main.py +++ b/app/main.py @@ -27,11 +27,11 @@ def __add__(self, other: T | int | float) -> T: def __iadd__(self, other: T | int | float) -> T: if isinstance(other, Distance): self.km += other.km - return self if isinstance(other, (int, float)): self.km += other - return self - raise TypeError("Unsupported operand types") + if not isinstance(other, (Distance, int, float)): + raise TypeError("Unsupported operand types") + return self def __mul__(self, other: int | float) -> T: if isinstance(other, (int, float)):