Python · Exercise 6 of 6 Previous
Intermediate
Power with recursion
Write a recursive function power(base, exponent) for whole-number exponents of 0 or more. Do not use ** or loops.
power(2, 0) is 1.
What Check tests
power(2, 10)is 1024power(5, 0)is 1power(3, 1)is 3- The function calls itself
- A deeper call works
- A zero base is fine
- No loops and no ** in your function
Stuck? One hint at a time
The solution unlocks after your first Check. Try first: that is where the learning happens.
main.py
Sign in to run your code.
Output
Press Run to see what your program prints.