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
Here we will accept a number from user as int value. We will use ** to calculate cube of the number and store it in a variable. Finally we will print variable on screen.
Please check our video tutorial on program to find cube of a number in python:
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.
program to find cube of a number in python snapshot:
This wraps up our session on program to find cube of a number in python or python program to find cube of a number.
Would you like to see your article here on tutorialsinhand.
program by tutorialsinhand.com
About the Author
Full Stack Web Developer & Blockchain Enthusiast
Page Views :
Published Date :