Python math.pow()

christian.dinh's avatar
Published May 21, 2021Updated Mar 17, 2024
Contribute to Docs

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

  • Looking for an introduction to the theory behind programming? Master Python while learning data structures, algorithms, and more!
    • Includes 6 Courses
    • With Professional Certification
    • Beginner Friendly.
      75 hours
  • Learn the basics of Python 3.12, one of the most powerful, versatile, and in-demand programming languages today.
    • With Certificate
    • Beginner Friendly.
      24 hours

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))

The above code gives the following output:

125.0

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

import math
print(math.pow(5.5, 3.3))

The above code gives the following output:

277.457759723262

Codebyte Example

Run the following example that uses the math.pow() function to understand its working:

Code
Output
Loading...

All contributors

Contribute to Docs

Learn Python on Codecademy

  • Looking for an introduction to the theory behind programming? Master Python while learning data structures, algorithms, and more!
    • Includes 6 Courses
    • With Professional Certification
    • Beginner Friendly.
      75 hours
  • Learn the basics of Python 3.12, one of the most powerful, versatile, and in-demand programming languages today.
    • With Certificate
    • Beginner Friendly.
      24 hours