Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a Python program to determine the densities of a collection of cylindrical containers. Your program should include a list of the contents of the
Write a Python program to determine the densities of a collection of cylindrical containers. Your program should include a list of the contents of the five containers. Using a for loop, it should successively prompt the user for the height and diameter in feet and weight in pounds of each container. Each prompt should include the contents of the container whose dimensions and weight is to be input. It should call a function that accepts the height, diameter and weight as parameters and returns the density for that container. The volume of a cylinder is calculated as diameter × π × height. Density is calculated as weight/volume. The density should be appended to a new array for density. The array should then be displayed. Using a second loop it should traverse the array of densities and call another function that accepts the density as a parameter and returns whether the container has low density, average density, or high density. The number of containers in each category should be counted and the number in each of those categories should be displayed. You should decide on the contents of the five containers and the thresholds used for categorization.
This program should include the design steps/pseudocode from your design as comments. Document the thresholds you chose for low density, average density, or high density in your comments as well.
This program should include the design steps/pseudocode from your design as comments. Document the thresholds you chose for low density, average density, or high density in your comments as well.
Step by Step Solution
★★★★★
3.39 Rating (152 Votes )
There are 3 Steps involved in it
Step: 1
Below is a Python program that follows your requirements to determine the densities of cylindrical c...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started