Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from math import*
- def main():
- 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!")
- cubeLength = int(input("We are going to calculate the surface area and volume of a cube. How wide is our cube?")
- sphereDiameter = int(input("Now we'll calculate it for a sphere. How wide is our sphere?"))
- cylinderHeight = int(input("Now well do the same for a cylinder. How tall is the cylinder?"))
- cylinderWidth = int(input("Now how wide is the cylinder?"))
- coneHeight = int(input("We'll also this for a cone. How tall is the cone?"))
- coneWidth = int(input("How wide is the cone?")
- cubeArea = pow(cubeLength,2) * 6
- cubeVolume = pow(cubeLenth,3)
- sphereArea = float(2 * 3.14 * pow(sphereDiameter / 2, 2))
- sphereVolume = float((4/3) * 3.14 * pow(sphereDiameter / 2, 3))
- radius2 = cylinderWidth / 2
- cylinderArea = float((2 * 3.14 * pow(radius2,2)) + (cylinderHeight * 3.14)
- cylinderVolume = float(3.14 * pow(radius2,2) * cylinderHeight)
- radius = coneWidth / 2
- coneArea = float((3.14 * radius) * (radius + sqrt(pow(coneHeight,2) + pow(radius,2)))
- coneVolume = float((1/3) * 3.14 * pow(radius,2) * coneHeight)
- print("The surface area of your cube is " + str(cubeArea)
- print("The volume of your cube is " + str(cubeVolume))
- print("")
- print("The surface area of your sphere is " + str(sphereArea))
- print("The volume of your sphere is " + str(sphereVolume))
- print("")
- #print("The surface area or your cylinder is " + str(cylinderArea))
- #print("The volume of your cylinder is " + str(cylinderVolume))
- print("")
- print("The surface area of your cone is " + str(coneArea))
- print("The volume of your cone is " + str(coneVolume))
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement