Ask Now
Course Intro
Curriculum
Get Started
1 / 2
What code should be placed in the function where it calls itself when writing a function that calculates the sum from 1 to n using recursion?
def
sum_recursive(n):
if
n
==
1:
return
1
else:
return
n
+
(n-1)
sum_recursive
sum
n
recursive
Previous
Confirm