The function sum_of_factorials takes one parameter: n (integ…
The function sum_of_factorials takes one parameter: n (integer). It should return the sum of factorials from 1! up to n!. For example: sum_of_factorials(4) should return1! + 2! + 3! + 4! = 33. However, the function contains multiple logic and syntax 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 sum_of_factorials(n):2. total = 03. fact = 04. for i in range(1, n):5. fact = fact * i6. total += fact7. return totals
Read Details