YouTip LogoYouTip

Python3 Func Number Pow

# Python3.x Python3 pow() Function [![Image 3: Python3 Numbers](#) Python3 Numbers](#) * * * ## Description The **pow()** method returns the value of x y (x raised to the power y). * * * ## Syntax Here is the syntax for the pow() method in the math module: import math math.pow( x, y ) The built-in pow() method pow(x, y[, z]) The function calculates x raised to the power y. If z is present, it then performs a modulo operation on the result, which is equivalent to pow(x,y) % z. **Note:** pow() is called directly via the built-in method, which treats arguments as integers, while the math module converts arguments to float. * * * ## Parameters * x -- A numeric expression. * y -- A numeric expression. * z -- A numeric expression. * * * ## Return Value Returns the value of x y (x raised to the power y). * * * ## Example The following examples demonstrate the use of the pow() method: ## Example #!/usr/bin/python3 import math # Import the math module print("math.pow(100, 2) : ", math.pow(100, 2)) # Using the built-in function to see the difference in output print("pow(100, 2) : ", pow(100, 2)) print("math.pow(100, -2) : ", math.pow(100, -2)) print("math.pow(2, 4) : ", math.pow(2, 4)) print("math.pow(3, 0) : ", math.pow(3, 0)) The output of the above example is: math.pow(100, 2) : 10000.0 pow(100, 2) : 10000 math.pow(100, -2) : 0.0001 math.pow(2, 4) : 16.0 math.pow(3, 0) : 1.0 [![Image 4: Python3 Numbers](#) Python3 Numbers](#)
← R JavaR Line_Charts β†’