Function Recursion Exercise
Question 1 of 5
You need to write a recursive function to calculate the power of a number (base^exponent). Which implementation is correct?
# Calculate 2^3 = 8def power(base, exp):
if exp == 0:
return 0
return base * power(base, exp - 1)```def power(base, exp):
if exp == 0:
return 1
return base * power(base, exp - 1)```def power(base, exp):
if exp == 1:
return base
return base * power(base, exp - 1)```def power(base, exp):
return base * power(base, exp - 1)```