Basic in-place addition
Input
iadd_demo(2, 3)
Output
5
Creates MutableNumber(2), does += 3 (an int). The internal value becomes 5 and that value is returned by the helper function.
Full lesson preview
Implement in-place addition behavior for a mutable numeric wrapper using __iadd__.
Problem statement
Task
Examples
Input
iadd_demo(2, 3)
Output
5
Creates MutableNumber(2), does += 3 (an int). The internal value becomes 5 and that value is returned by the helper function.
Input format
Output format
Constraints
Samples
Input
iadd_demo(10, MutableNumber(5))
Output
15
Adding another MutableNumber adds its value.