# Python pow() method

## pow() in Python

Python pow() function returns the power of the given numbers. This function computes x**y. This function first converts its arguments into float and then computes the power.

Syntax: pow(x,y)

Parameters :

• x : Number whose power has to be calculated.
• y : Value raised to compute power.

Return Value :  Returns the value x**y in float.

## Python pow() example

### Example 1: Working of pow()

 `# Python code to demonstrate pow()` `# version 1` `print``(``"The value of 3**4 is : "``, end``=``"")` `# Returns 81` `print``(``pow``(``3``, ``4``))`

Output:

`The value of 3**4 is : 81.0`

### Example 2: Python pow() with three argument

float pow(x,y,mod) function computes (x**y) % mod. This function first converts its arguments into float and then computes the power.

Syntax: float pow(x,y,mod)

Parameters :

• x : Number whose power has to be calculated.
• y : Value raised to compute power.
• mod :  Value with which modulus has to be computed.

Return Value :  Returns the value (x**y) % mod in float.

 `# Python code to demonstrate pow()` `# version 2` `print``(``"The value of (3**4) % 10 is : "``, end``=``"")` `# Returns 81%10` `# Returns 1` `print``(``pow``(``3``, ``4``, ``10``))`

Output:

`The value of (3**4) % 10 is : 1`

### Implementation Cases in pow() :

 `# Python code to discuss negative` `# and non-negative cases` `# positive x, positive y (x**y)` `print``(``"Positive x and positive y : "``, end``=``"")` `print``(``pow``(``4``, ``3``))` `print``(``"Negative x and positive y : "``, end``=``"")` `# negative x, positive y (-x**y)` `print``(``pow``(``-``4``, ``3``))` `print``(``"Positive x and negative y : "``, end``=``"")` `# positive x, negative y (x**-y)` `print``(``pow``(``4``, ``-``3``))` `print``(``"Negative x and negative y : "``, end``=``"")` `# negative x, negative y (-x**-y)` `print``(``pow``(``-``4``, ``-``3``))`

Output:

```Positive x and positive y : 64
Negative x and positive y : -64
Positive x and negative y : 0.015625
Negative x and negative y : -0.015625```

Last Updated on November 13, 2021 by admin

## Render HTML Forms (GET & POST) in DjangoRender HTML Forms (GET & POST) in Django

Render HTML Forms (GET & POST) in Django Django is often called “Batteries Included Framework”

## Indexing and Selecting Data with PandasIndexing and Selecting Data with Pandas

Indexing and Selecting Data with Pandas Indexing in Pandas : Indexing in pandas means simply

## Python Projects – Beginner to AdvancedPython Projects – Beginner to Advanced

Python Projects – Beginner to Advanced Python has become one of the most popular languages.

## Python – Create a directoryPython – Create a directory

Create a directory in Python The OS module in Python provides functions for interacting with

## Context Manager in PythonContext Manager in Python

Context Manager in Python Managing Resources : In any programming language, the usage of resources like

## Python end parameter in print()Python end parameter in print()

Python end parameter in print() By default python’s print() function ends with a newline. A

## FuzzyWuzzy Python libraryFuzzyWuzzy Python library

FuzzyWuzzy Python library There are many methods of comparing string in python. Some of the

## Take Matrix input from user in PythonTake Matrix input from user in Python

Take Matrix input from user in Python Matrix is nothing but a rectangular arrangement of