Question: PLE HELP ME BY PYTHON Part 1: Planetary Density contains a list of the density in grams per cubic centimeter of all the planets, plus

 PLE HELP ME BY PYTHON Part 1: Planetary Density contains a

PLE HELP ME BY PYTHON

Part 1: Planetary Density contains a list of the density in grams per cubic centimeter of all the planets, plus Pluto. It looks like File density.txt this: Mercury 5.43 Venus 5.25 Earth 5.52 Mars 3.83 Jupiter 1.33 Saturn 0.71 Uranus 1.24 Neptune 1.67 Pluto 2.85 Write a program named Lostname_firstname_density.py that reads the numbers from the file into a list and then calculates and prints, properly labeled: The minimum density The maximum density The average density The median density (Hint: use split() to separate the planet name from the density.) You don't need a list for the first three of these, but you do need a list to calculate the median. Finding the Median To find the median of a group of n numbers, sort them into order. (Hint: use Python's sort method). If n is odd, the median is the middle entry. In a list named data this will be element catatan - 1) // 2] . Note the use of // to do integer division. If nis even, the median is the average of the numbers "surrounding the middle. For a list named data, this is (data[(n // 2)] = data[(n // 2) - 1]) / 2.0. Your program must work for a file with any number of entries. The file I am providing happens to have an odd number of entries, but if I gave you a similar file for the major moons of Saturn, it would have an even number of entries, and your program would still have to correctly calculate the statistics for that file

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!