Functions · 23 / 27 Exercise Medium

Function to calculate the power of a number

Objective

Create a Python program with a function called calculate_power() that calculates the result of raising an integer to the power of another integer.

Instructions

  • In the main function, ask the user for two integers.
  • Implement the function calculate_power() with both integers as parameters. It returns the first number raised to the power of the second one.
  • Print the result of the calculation.
Input
2
3
Output
Result: 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