Advertisement
Guest User

Untitled

a guest
Oct 16th, 2019
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.01 KB | None | 0 0
  1. from math import pi     # this statement imports pi (3.1415...) from the math module
  2.  
  3.  
  4. def cubeVolume(sideLength):            # this function calculates the volume for a cube
  5.     volumeOfCube = sideLength ** 3     # this is the formula for the volume of a cube
  6.     return volumeOfCube                # returns the calculation from the above statement
  7.  
  8.  
  9. def pyramidVolume(baseLength, height):               # this function calculates the volume for a pyramid
  10.     volumeOfPyramid = ((baseLength**2)*height)/3     # this is the formula for the volume of a pyramid
  11.     return volumeOfPyramid                           # returns the calculation from the above statement
  12.  
  13.  
  14. def ellipsoidVolume(radius1, radius2, radius3):                  # this function calculates the volume for an ellipsoid
  15.     volumeOfEllipsoid = ((4*pi)*(radius1*radius2*radius3))/3     # this is the formula for the volume of an ellipsoid
  16.     return volumeOfEllipsoid                                     # returns the calculation from the above statement
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement