Sum or Product
Programming Questions
Sum or Product
You are given a function sum_and_product, with integers a, b, and boolean multiply. You are to do the following:
If multiply is True, then multiply the numbers together. Otherwise, add the numbers together.
Input:
- a: An integer
- b: An integer
- multiply: A boolean
Example 1:
sum_or_product(5, 7, False) = 12
Example 2:
sum_or_product(5, 7, True) = 35
Tests - Login / Sign up to submit your code!
Efficiency
Test Case 1
Test Case 2
Test Case 3
Test Case 4
Test Case 5
Test Case 6
Test Case 7
Test Case 8
Test Case 9
Test Case 10
Test Case 11
Test Case 12
Submit to See Results
Submit to See Results
Submit to See Results
Submit to See Results
Submit to See Results
Submit to See Results
Submit to See Results
Submit to See Results
Submit to See Results
Submit to See Results
Submit to See Results
Submit to See Results
Submit to See Results