Challenge
Implement sum_or_product(a, b, multiply). Return a * b when the Boolean multiply is true; otherwise return a + b. The inputs a and b are integers. Return an integer; do not print it.
Target complexity: O(1)
Return values are checked by type. Use the exact function name. Print output is not your answer. Tests have time and memory limits.
Public examples
Arguments
[3, 2, False]
Expected return
5
Arguments
[3, 2, True]
Expected return
6
Hint
Match the return value and type to the contract.
The worked solution unlocks after completion, or with Premium access.