Articles

Program to find cube of a number in python

Program to find cube of a number in python


In this python program guide, we will learn to write a:

  • program to find cube of a number in python

Python program to find cube of a number

Given below we write a program to find cube of a number in python:

 

# Owner : TutorialsInhand Author : Devjeet Roy

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

cube = number ** 3

print("The cubed value is:",cube)

The output of python code to find cube of a number is:

 

PS C:\Users\DEVJEET\Desktop\tutorialsInHand> python code.py
Enter the number: 3
The cubed value is: 27

Few important points about this program:

1. We take the input from the user using the input() function. We convert the input to its int type using int() function.

2. We do exponential calculations using the "**" operator. The number before the operator denotes the base and the number after the operator denotes the exponent.

 

python code to find cube of a number

 


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 26,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!