Facebook Page Twitter Page LinkedIn Page
× Python Examples


If a number is multiplied by itself two times (n*n*n), the final number will be the cube of that number and finding the cube root of a number is inverse operation of cubing the number. If x is the cube root of y, it can be expressed as below:

cube root

Alternatively, it can also be expressed as:

x3 = y

Method 1: Using exponential (**) operator

The exponential (**) operator of Python can be used to calculate the cube root of a number. Consider the following example.

x = 64
y = 125
x1 = x**(1/3)
y1 = y**(1/3)
print("Cube root of", x, "is",x1)
print("Cube root of", y, "is",y1)

The above code will give the following output:

Cube root of 64 is 4.0
Cube root of 125 is 5.0

Method 2: Using pow() method of math Module

The pow() method of math module can also be used to calculate cube root of a number.

import math

x = 64
y = 125
x1 = math.pow(x, 1/3)
y1 = math.pow(y, 1/3)
print("Cube root of", x, "is",x1)
print("Cube root of", y, "is",y1)

The above code will give the following output:

Cube root of 16 is 4.0
Cube root of 25 is 5.0