The function sum_sequence takes two parameters: start and en…
The function sum_sequence takes two parameters: start and end (integers). It should return the sum of all numbers in this pattern: start number + (start × 2) + (start × 3)… until the result would exceed the end number. For example, sum_sequence(2, 20) should return 20 because: It calculates: 2 + (2×2) + (2×3) + (2*4) Which is: 2 + 4 + 6 + 8 = 20 (We stop here because adding 2×5 = 10 would make sum 30, which exceeds the end,20) However, the function contains 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_sequence(start, end)2. total = 03. multiplier = 04. while total < end:5. current = start + multiplier6. total += current7. multiplier + 18. return total
Read Details