Advertisement
Guest User

Untitled

a guest
Sep 20th, 2018
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.73 KB | None | 0 0
  1. from math import*
  2. def main():
  3. print("We are going to do some calculations together. I got the math under my belt just tell me what I need and we can get started!")
  4. cubeLength = int(input("We are going to calculate the surface area and volume of a cube. How wide is our cube?")
  5. sphereDiameter = int(input("Now we'll calculate it for a sphere. How wide is our sphere?"))
  6. cylinderHeight = int(input("Now well do the same for a cylinder. How tall is the cylinder?"))
  7. cylinderWidth = int(input("Now how wide is the cylinder?"))
  8. coneHeight = int(input("We'll also this for a cone. How tall is the cone?"))
  9. coneWidth = int(input("How wide is the cone?")
  10.  
  11. cubeArea = pow(cubeLength,2) * 6
  12. cubeVolume = pow(cubeLenth,3)
  13.  
  14. sphereArea = float(2 * 3.14 * pow(sphereDiameter / 2, 2))
  15. sphereVolume = float((4/3) * 3.14 * pow(sphereDiameter / 2, 3))
  16.  
  17. radius2 = cylinderWidth / 2
  18. cylinderArea = float((2 * 3.14 * pow(radius2,2)) + (cylinderHeight * 3.14)
  19. cylinderVolume = float(3.14 * pow(radius2,2) * cylinderHeight)
  20.  
  21. radius = coneWidth / 2
  22. coneArea = float((3.14 * radius) * (radius + sqrt(pow(coneHeight,2) + pow(radius,2)))
  23. coneVolume = float((1/3) * 3.14 * pow(radius,2) * coneHeight)
  24.  
  25. print("The surface area of your cube is " + str(cubeArea)
  26. print("The volume of your cube is " + str(cubeVolume))
  27. print("")
  28. print("The surface area of your sphere is " + str(sphereArea))
  29. print("The volume of your sphere is " + str(sphereVolume))
  30. print("")
  31. #print("The surface area or your cylinder is " + str(cylinderArea))
  32. #print("The volume of your cylinder is " + str(cylinderVolume))
  33. print("")
  34. print("The surface area of your cone is " + str(coneArea))
  35. print("The volume of your cone is " + str(coneVolume))
  36.  
  37. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement