Recursion · 6 / 18 Exercise Medium

Calculate power recursively

Objective

Create a Python program with a recursive function that calculates the result of raising an integer to the power of another integer.

Instructions

  • Ask the user for two integers: the base and the exponent.
  • Implement a recursive function called power that receives the base and the exponent and returns the base raised to the exponent.
  • Print the result of the calculation.
Input
2
3
Output
8

Open the editor in full screen: the statement on the left and your code, the output and the tests on the right.

Start exercise