math.pow()

Returns the float value of x raised to the power of y.

Syntax

math.pow(x, y)

This contrasts with the built-in ** operator in that math.pow() converts both its arguments to type float.

Example 1

Use math.pow() to return 5 to the power of 3:

import math
print(math.pow(5, 3))
# Output: 125.0

Example 2

Use math.pow() to return 5.5 to the power of 3.3:

import math
print(math.pow(5.5, 3.3))
# Output: 277.457759723262

Contributors

Interested in helping build Docs? Read the Contribution Guide or share your thoughts in this feedback form.

Learn Python on Codecademy

Contributors