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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!