PIXELBANKv9.1.0
Menu

Implement pow(x, n) which calculates x raised to the power n. Output with 5 decimal places.

Example:

Input:
2.00000
10
Output:
1024.00000
Reasoning:
  • The function pow(x, n) takes two parameters: the base x and the exponent n. In this case, x = 2.00000 and n = 10.
  • We apply the exponentiation: result=xn=2.0000010=1024.00000result = x^n = 2.00000^{10} = 1024.00000
  • The final output is rounded to 5 decimal places, which in this case is still 1024.00000.
  • The calculated value is then returned as the result of the function.

Constraints:

  • -100 < x < 100
  • -2^31 <= n <= 2^31 - 1
solution.py

Test Results

0/0
Run code to see test results.
Pow(x, n) - Medium | PixelBank