Articles

Program to find cube root of a number in Python

Program to find cube root of a number in Python


In this Python programs guide, we will learn to write:

  • program to find cube root of a number in python

Python program to find cube root of a number

The program to find cube root of a number in python is as follows:

 

# Owner : TutorialsInhand Author : Devjeet Roy

import math

number = int(input("Enter the number: "))

cuberoot = math.ceil(number ** (1/3))

print("The cube root is:",cuberoot)

The output of python program to find cube root of a number is:

 

PS C:\Users\DEVJEET\Desktop\tutorialsInHand> python code.py
Enter the number: 512
The cube root is: 8

Few important points about this program:

1. We have used math library here.

2. We have used .ceil() method here is 1/3 is recurring in nature. .ceil() gives the nearest ceiling value to the answer.

 

Given below is the screenshot of how to find cube root of a number in python:

 

program to find cube root of a number in python

 


Basic Python Programs

Would you like to see your article here on tutorialsinhand. Join Write4Us program by tutorialsinhand.com

About the Author
Devjeet Roy
Full Stack Web Developer & Data Science Enthusiast
Page Views :    Published Date : Jan 30,2021  
Please Share this page

Related Articles

Like every other website we use cookies. By using our site you acknowledge that you have read and understand our Cookie Policy, Privacy Policy, and our Terms of Service. Learn more Got it!