Question: Write python code for a function SUMMATION(N) that returns the sum of numbers 1 through N. So if one calls SUMMATION (4) it returns the
Write python code for a function SUMMATION(N) that returns the sum of numbers 1 through N. So if one calls SUMMATION (4) it returns the value 10, which is computed from (1 + 2 + 3 + 4).
Write two different implementations of the function - one using iterative and another using recursive. The iterative implementation can use a for loop or a while loop. The recursive implementation should show the base case and make sure the function has a recursive call.
(Use spaces to show indentation as needed.)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
