Topics: Recursion: iteration vs. recursion, inductive reasoning
Lecture Notes
Readings
Ch 6.1
Finger Exercise Lecture 15
Implement the function that meets the specifications below:
def recur_power(base, exp):
"""
base: int or float.
exp: int >= 0
Returns base to the power of exp using recursion.
Hint: Base case is when exp = 0. Otherwise, in the recursive
case you return base * base^(exp-1).
"""
# Your code here
# Examples:
print(recur_power(2,5) # prints 32