{"id":24161,"date":"2021-10-14T08:33:42","date_gmt":"2021-10-14T03:03:42","guid":{"rendered":"https:\/\/python-programs.com\/?p=24161"},"modified":"2021-11-05T20:54:23","modified_gmt":"2021-11-05T15:24:23","slug":"how-to-find-cube-root-in-python","status":"publish","type":"post","link":"https:\/\/python-programs.com\/how-to-find-cube-root-in-python\/","title":{"rendered":"How to Find Cube Root in Python"},"content":{"rendered":"

In the previous article, we have discussed Python Program for isfinite() Function<\/a>
\nGiven a number and the task is to calculate the cube root of a given number in Python.<\/p>\n

Cube root:<\/strong><\/p>\n

A cube root is a number that, when cubed, yields a given number. A number’s cube root is a value that, when multiplied by itself three times, yields the original value.<\/p>\n

\u20183\u221a\u2019 represents the cube root symbol. In the case of square root, we simply used the root symbol, such as \u2018\u221a\u2019, which is also known as a radical.<\/p>\n

For example :<\/p>\n

The cube root of 27 is 3. (3*3*3=27)<\/p>\n

Cube root of a Negative Number:<\/strong><\/p>\n

We cannot find the cube root of negative numbers using the method described above. The cube root of integer -27, for example, should be -3, but Python returns 1.5000000000000004+2.598076211353316j.<\/p>\n

To calculate the cube root of a negative number in Python, first, use the abs() function, and then use the simple math equation.<\/p>\n

Examples:<\/strong><\/p>\n

Example1:<\/strong><\/p>\n

Input:<\/strong><\/p>\n

Given Number = 125<\/pre>\n

Output:<\/strong><\/p>\n

The cube root of the given number { 125 } =  4.999999999999999<\/pre>\n

Example2:<\/strong><\/p>\n

Input:<\/strong><\/p>\n

Given Number = -27<\/pre>\n

Output:<\/strong><\/p>\n

The cube root of the given number { -27 } = -3.0<\/pre>\n

Program for How To Find Cube Root in Python<\/h2>\n

Below are the ways to calculate the cube root of a given number in python:<\/p>\n