In this guide, we are going to learn all about the Python pow() function to return the value of x to the power of y (xy).
If a third parameter is present, it returns x to the power of y, modulus z.
Table of Contents
Python pow() function
Python pow function is a built-in function that is used to find the value of b to the power of y.
Syntax
The syntax of pow function in Python is:-
pow(x, y, z)
Parameters
pow function in Python accepts three parameters.
- x:- A number, the base.
- y:- A number, the exponent.
- z:- Optional, A number, the modules.
Python pow examples
Here we will take some examples to understand pow function.
Example 1:
Use python pow function with two parameter.
x = 4
y = 3
result = pow(x, y)
print(result)
Output will be:- 64
Example 2:
#Use Python pow function with third parameter.
x = 4
y = 3
z = 5
result = pow(x, y, z)
print(result)
Output will be:- 5
Conclusion
In this article, you have learned all about the pow function to return the value of x to the power of y. If you like this article, please share it and keep visiting for further python built-in functions tutorials.
Python built-in functions
For more information:- Click Here