The pow()
function calculates the value of the power
of another
Figure 1 shows the mathematical representation of the pow()
function.
The
math
module is required for this function.
pow(baseNumber, exponent)
The pow()
function requires two parameters:
pow()
returns the value of the base number raised to the exponent number.
import math#positive: baseNumber positive: exponentprint "The value of pow(2,3) : ", math.pow(2,3)#positive: baseNumber negative: exponentprint "The value of pow(0.25,-2) : ", math.pow(0.25,-2)#negative: baseNumber positive: exponentprint "The value of pow(-10,2) : ", math.pow(-10,2)#negative: baseNumber negative: exponentprint "The value of pow(-0.5,-1) : ", math.pow(-0.5,-1)