Update page 'Day 3 homework - Sloetjes'
@@ -59,13 +59,7 @@ class BoundedInt:
|
||||
if self.max is not None and result > self.max:
|
||||
raise ValueError("Value exceeds maximum bound.")
|
||||
return BoundedInt(result, self.min, self.max)
|
||||
|
||||
def __sub__(self, other):
|
||||
result = self.i - other
|
||||
if self.min is not None and result < self.min:
|
||||
raise ValueError("Value exceeds minimum bound.")
|
||||
return BoundedInt(result, self.min, self.max)
|
||||
|
||||
|
||||
def __radd__(self, other):
|
||||
return self.__add__(other)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user