Update page 'Day 3 homework'
@@ -33,3 +33,4 @@ class BoundedInt():
|
|||||||
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.
|
||||||
|
10. You don't have to implement the code, but think about how you would change the template so it could allow adding a BoundedInt to an emoji, if there was a hypothetical function sentiment(emoji) which returned a floating point number from -10.0 to 10.0 which indicated whether the emoji was happy or sad. e.g. BoundedInt(1, min = 1, max = 10) + 😁 would raise `ValueError`.
|
||||||
|
|||||||
Reference in New Issue
Block a user