pow(x, y) function in Python is used to find value of x raised to the power of y (xy).

Syntax

Parameters

Python pow() function parameters
ParameterConditionDescription
xRequiredBase
yRequiredExponent
zOptionalModulus

The third parameter (z) is optional, but when specified pow() function returns xy%z.

Let’s see some examples to get a better understanding.

Examples

We can also achieve the above result by using 2**4 in Python.

Example of pow() when all 3 parameters are specified.

When y parameter is negative then pow() returns float number as the result.

If you have any doubts or suggestions then please comment below.

Leave a Reply