Update page 'Day 3 homework'
+1
-1
@@ -29,7 +29,7 @@ class BoundedInt():
|
|||||||
5. Don't forget that you can access the value of a BoundedInt by using either `.i` on it, or `int()`, now that you've passed test 1.
|
5. Don't forget that you can access the value of a BoundedInt by using either `.i` on it, or `int()`, now that you've passed test 1.
|
||||||
6. Modify the template to pass test 2, which checks that:
|
6. Modify the template to pass test 2, which checks that:
|
||||||
* Your class implements the + operator.
|
* Your class implements the + operator.
|
||||||
* It throws ValueError when attempting to add two BoundedInts that will exceed the limits.
|
* It throws ValueError when attempting to add another BoundedInt that would exceed `self.max`.
|
||||||
7. Do the same as 6, but for subtraction, to pass test 3.
|
7. Do the same as 6, but for subtraction, to pass test 3.
|
||||||
8. Modify the template so it also supports adding a regular integer to a BoundedInt, to pass test 4. Note that you can use `isinstance()` to determine the class of a variable.
|
8. Modify the template so it also supports adding a regular integer to a BoundedInt, to pass test 4. Note that you can use `isinstance()` to determine the class of a variable.
|
||||||
9. Same as 8, but for subtraction.
|
9. Same as 8, but for subtraction.
|
||||||
|
|||||||
Reference in New Issue
Block a user