Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from math import pi # this statement imports pi (3.1415...) from the math module
- def cubeVolume(sideLength): # this function calculates the volume for a cube
- volumeOfCube = sideLength ** 3 # this is the formula for the volume of a cube
- return volumeOfCube # returns the calculation from the above statement
- def pyramidVolume(baseLength, height): # this function calculates the volume for a pyramid
- volumeOfPyramid = ((baseLength**2)*height)/3 # this is the formula for the volume of a pyramid
- return volumeOfPyramid # returns the calculation from the above statement
- def ellipsoidVolume(radius1, radius2, radius3): # this function calculates the volume for an ellipsoid
- volumeOfEllipsoid = ((4*pi)*(radius1*radius2*radius3))/3 # this is the formula for the volume of an ellipsoid
- return volumeOfEllipsoid # returns the calculation from the above statement
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement