Write a function product or sum(num1, num2) that takes two int parameters and returns either their sum or their product,
-
answerhappygod
- Site Admin
- Posts: 899604
- Joined: Mon Aug 02, 2021 8:13 am
Write a function product or sum(num1, num2) that takes two int parameters and returns either their sum or their product,
Write a function product or sum(num1, num2) that takes two int parameters and returns either their sum or their product, whichever is larger. In the first example below, the sum (17. 1) is greater than the product (171), so the sum is returned. In the second example, the product (211) is greater than the sum (2+11), so the product is returned For example: Test Result print (product_or_sum(17, 1)) 18 print (product or sum(2, 11)) 22
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!