Power in Python offers pow() as a method to compute power of a number. pow() is one of the built-in functions in Python and can make the task of calculating power easier. pow() has many applications in day to day programming, making it an important function for programmers.
This blog post will discuss pow(), its use cases, and how it can be implemented using Python. pow() has the following syntax pow(number, power) pow() can take two arguments – number and power. The first argument is mandatory while the second one is optional.
Some of Python Built-in Functions are mentioned:
Table of Contents
Power in Python: Using Pow(x,y): A function to compute x**y
In mathematics, a power is the result of multiplying a number by itself some number of times. For example, 3**2 means that 3*3=9. Using this function, you can compute x**y easily.
syntax
The syntax for Pow() function is:
pow(x,y)
Parameters
- x: Number whose power has to be calculated.
- y: Value raised to compute the power.
Return value: Returns the value x^y in float format.
Example Code
x = 3
y = 3
power = pow(x,y)
print("3^3 or 3**3 = ", power)
Output

Power in Python: Using Float pow(x,y,mod) : A function to compute (x**y) % mod
This function computes the power of float, float pow(x,y,mod). This function first converts its arguments into float and then computes the power.
Syntax
Syntax float pow(x,y,mod)
Parameters
- x: Number whose power has to be calculated.
- y: Value raised to compute power.
- mod: Value with which modulus has to be computed.
Return Value: float Returns the value (x ** y) % mod in float.
Example Code
x = 3
y = 3
mod = 5
power = pow(x,y,mod)
print("3^3%5 or 3**3%5 = ", power)
Output

Conclusion
In this blog post, we’ve discussed the power in Python. We talked about how you can use pow(x,y) to compute x**y and Float pow(x,y,mod) to compute (x**y) % mod.