73.6k views
5 votes
Write a program to calculate the volume of a cube in python​

1 Answer

4 votes

Answer:

Here's a simple Python program that calculates the volume of a cube:

```

# Get the length of the cube from the user

length = float(input("Enter the length of the cube: "))

# Calculate the volume of the cube

volume = length ** 3

# Print the volume of the cube

print("The volume of the cube is", volume)

```

In this program, we first get the length of the cube from the user using the `input()` function. We then use the formula for the volume of a cube, which is `length ** 3`, to calculate the volume. Finally, we print the volume of the cube using the `print()` function.

User Oetoni
by
8.4k points

No related questions found