# Python pow() function with live practice example

In this tutorial, you will learn about how to compute power of one number with another number using python inbuilt function pow(). Python makes easy our job with great function.

Syntax : pow(x,y,[z):

Pow() Function Parameters:

It has mainly 3 parameters
x – It’ is a number which is to be powered
y – It’s number which is to be powered with x
z  – (Optional) – it’s number which is to be used for modulus operation

Example: If you want calculate the power of 2 with 3, we have to pow(2,3), which is equivalent to 2**3

We can use this function with integers, float number and complex numbers. We can compute the power values for positive and negative values also.

### # Pow() Function For Integer values

` ` ``` x=3 y=3 z =pow(x,y) print(" power of 3 with 3: ",z) ``` ` ` ` `

Output:

`power of 3 with 3: 27`

### # Pow() Function For float values

` ` ``` x=3.5 y=3.2 z =pow(x,y) print(" power of 3.5 with 3.2: ",z) ``` ` ` ` `

Output:

`power of 3.5 with 3.2: 55.08301986166747`

### # Pow() Function For complex values:

` ` ``` x=3j y=2j z =pow(x,y) print(" power of 3j with 2j: ",z) [datacamp_exercise] # Pow() Function for positive and negative numbers: #positive with positive value x=2 y=2 z =pow(x,y) print(” power of 2 with 2: “,z) #positive and negative value x=2 y=-2 z =pow(x,y) print(” power of 2 with -2: “,z) #negative with positive value x=-2 y=2 z =pow(x,y) print(” power of -2 with 2: “,z) #negative with negative value x=-2 y=-2 z =pow(x,y) print(” power of -2 with -2: “,z) Output: power of 2 with 2: 4 power of 2 with -2: 0.25 power of -2 with 2: 4 power of -2 with -2: 0.25 Pow() with 3 arguments like x, y and z (modulo operator) In this below example first it will calculate 2**2 = 4 then it calculate with 4/3 modulus. The final output is 1 x = 2 y = 2 z = 3 print(pow(x, y, z)) ```

` ` ` `

[/datacamp_exercise]

Output:

`1` 