In this tutorial, We learn to Python Program to find cube of a number with example.
Python program to find cube of a number
Written below to find cube of a number in python.
# Owner : Pythonsourcecode.com Author : Pushpam abhishek
number = int(input("Enter the number: "))
cube = number ** 3
print("The cubed value is:",cube)
Here The Output of cube number
Enter the number: 4
The cubed value is: 64
Python Program to Find Cube of a Number Using Functions
Here the Python program to find cube of a number using function below.
# Python Program to Find Cube of a Number Using Functions
def cube(num):
return num * num * num
num = int(input("Enter an number: "))
# Calling out function
cube_num = cube(num)
# Displaying output
print("Cube of {0} is {1}" .format(num, cube_num))
Here the Output the Cube of a number using function.
Enter an number: 14
Cube of 13 is 2744