Using Python: Write a method to calculate the volume of a shape….
Question Answered step-by-step Using Python: Write a method to calculate the volume of a shape…. Using Python:Write a method to calculate the volume of a shape. The first parameter will either be “sphere” or “cone” and the second will be a tuple of non-negative integers either giving just the radius or giving the radius and height in that order. Round the output to the hundredths place.If the shape is not either “sphere” or “cone” return the string “Invalid Shape”.NOTE: Do not use the Math module to obtain the PI value. Just use 3.14.The relevant formulas can be found here: https://sciencenotes.org/surface-area-formulas-volume-formulas/. It should have the following signature:def calculate_volume(shape, dimensions)For example: calculate_volume(“sphere”, (5,)) = 523.33 calculate_volume(“cone”, (3,7)) = 65.94 calculate_volume(“prism”, (2,2,1)) = “Invalid Shape” Computer Science Engineering & Technology Python Programming Share QuestionEmailCopy link Comments (0)


