Python math.pow() Method
Python math.pow(x, y) The method returns x raised to the power of y.
If x is negative and y is not an integer, a ValueError is returned. The method converts both arguments to floating-point numbers. math.pow(1.0,x) or math.pow(x,0.0) always returns 1.0.
Syntax
The syntax of the math.pow() method is as follows:
math.pow(x, y)
Parameter Description:
- x -- required, a number representing the base.
- y -- required, a number representing the exponent.
Return Value
Returns a floating-point number representing x raised to the power of y.
Example
The following example returns 9 to the power of 3:
Example
Import the math package
import
math
Output 9 to the power of 3
(
math
.
pow
(
9
,
3
)
)
Output result:
729.0
Python math Module