Python pow() Function

Python pow() function is used to compute the powers of a number. It returns x to the power of y modulus z if a third argument(z) is present, i.e. (x, y) % z.

Signature

Parameters

x: It is a number, a base

y: It is a number, an exponent.

z (optional): It is a number and the modulus.

Return

It returns x to the power of y modulus z, if a third argument(z) is given, i.e. (x, y) % z.

Python pow() Function Example 1:

The below example shows the working of pow().

Output:

16
16
0.0625
0.0625

Explanation: In the above example, we have taken different values of the argument (x,y) and returns x to the power of y.

Python pow() Function Example 2:

The below example shows pow() with three arguments (x, y, z)

Output:

1





Latest Courses