Python – Find x To Power y – pow() Function with Examples

pow() function is used to find the x to the power of y. If the third argument (z) is given, it returns x to the power of y modulus z, i.e. pow(x, y) % z in Python for the given input.

pow() function is a part of Python Built-in Functions.

Syntax of pow() Function

The syntax of pow() function in Python is:

pow(x, y[, z])

 

Parameters of pow() Function in Python

x – Where x is any valid . This parameter is required.

 

Compatibility

pow() function is available and compatible with both Python 2.x and 3.x.

 

Return Value of pow() Function in Python

pow() function returns x to the power of y. If the third argument (z) is given, it returns x to the power of y modulus z, i.e. pow(x, y) % z for the given input.

 

Python pow() Function Example 1

Example CODE

Output:

 

Python pow() Function Example 2

Example CODE

Output: