# How to calculate nth root on Python

To calculate the nth root of a number in the python language, use the pow() function using a fractional exponent.

**pow(a,1/b)**

- The first parameter is the
**radical of the root**. It is a real number. - The second parameter is the inverse of the root index.
- 1/2 = square root
- 1/3 = cubic root
- 1/4 = fourth root
- 1/5 = fifth rood
- 1/n = nth root ( index n )

The function calculates the square, cubic or nth root on any index.

**Note**. The computation of the nth root using pow() is based on a simple mathematical equivalence relationship between powers and roots.

## Practical examples

__Example 1__

This instruction takes the square root of 9.

pow(9,1/2)

3.0

A number raised to 1/2 equals the square root of the number.

Number 3 is the square root of 9.

__Example 2__

This statement calculates the cube root of 27.

pow(27,1/3)

3.0

A number raised to 1/3 is equivalent to calculating the cubic root of the number.

The result is 3 because 3 · 3 · 3 = 27.

__Example 3__

This statement calculates the fourth root of a number

pow(81,1/4)

3.0

The function returns the nth root with n = 4 of 81.

The result is 3 because 3^{4} = 81

**Report an error or share a suggestion to enhance this page**