The function calculate_product_of_evens takes one parameter:…
The function calculate_product_of_evens takes one parameter: n (integer). It should return the product of all even numbers from 1 to n. For example, calculate_product_of_evens(6) should return 48. This comes from 2 * 4 * 6. However, the function contains multiple logic errors. Identify and correct the errors in the code snippet so the function works as intended. You cannot change entire chunks of code nor rewrite it completely. Mention the line number where the error is, what the error is, and the correction. 1. def calculate_product_of_evens(n) 2. if n == 1:3. return 14. product = 0 5. for i in range(1, n): 6. if i % 2 == 0: 7. product *= n 8. return result
Read Details