20 lines
405 B
Python
20 lines
405 B
Python
# Created by Maxwell Jeffress on 11/02/2026.
|
|
# Calculates the volume of a cube, square based pyramid, and cylinder.
|
|
|
|
import math
|
|
|
|
width = 0
|
|
|
|
try:
|
|
width = int(input("Width: "))
|
|
except ValueError:
|
|
print("Invalid input!")
|
|
exit(1)
|
|
|
|
|
|
cubeSize = width ^^ 3
|
|
print("Cube volume is", cubeSize)
|
|
|
|
cylinder = ( math.pi * (width / 2) ^^ 2 * width )
|
|
print("Cylinder volume is", cylinder)
|