python program to find the volume of cube, cuboid and sphere
Answers
choice = "Yes"
while choice == "Yes":
print("1. Cube", "2. Cuboid", "3. Sphere", sep = "\n")
shape = input("Enter the choice of shape whose volume you'd like to find: ")
print()
if shape == "1":
x = int(input("Enter the side of the cube: "))
vol = x**3
print(vol, "is the volume of the cube.")
elif shape == "2":
x = int(input("Enter the length of the cuboid: "))
y = int(input("Enter the breadth of the cuboid: "))
z = int(input("Enter the height of the cuboid: "))
vol = x*y*z
print(vol, "is the volume of the cuboid.")
elif shape == "3":
r = int(input("Enter the radius of the sphere: "))
vol = (4/3)*3.14*r**3
print(vol, "is the volume of the sphere.")
print()
choice = input("Would you like to find the volume of another shape? [Yes/No]: ")
print()