Python pow() function
Definition and Usage
pow() function value of x raised to the power of y (xy).
If the third parameter is provided, it returns x raised to the power of y, then takes the remainder z.
Syntax
pow(x, y, z)
Parameter Value
Parameter | Description |
---|---|
x | Number, base. |
y | Number, exponent. |
z | Optional. Number, modulus. |
More Examples
Example
Returns the remainder of 5 to the power of 3 modulo 4 (equivalent to (5 * 5 * 5) % 4):
x = pow(5, 3, 4)