Facebook Page Twitter Page LinkedIn Page
× Python Tutorial Python Advanced Python Resources Python Libraries


The Python pow() function is used to calculate power of a number, for example: pow(x, y) returns value equal to x raised to the power y. This function has third optional parameter also, which calculates modulus of the previous with respect to third parameter, for example: pow(x, y, z) returns value equal to x raised to the power y modulus z.

Syntax

pow(x, y, z)

Parameters

x Required. A number, base.
y Required. A number, exponent.
z Optional. A number, modulus.

Example:

In the below example, pow() function is used to calculate power of a given number.

print(pow(2, 4))
print(pow(2, 4, 10))

The output of the above code will be:

16
6

❮ Python Built-in Functions