Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

PLE HELP ME BY PYTHON

image text in transcribed

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 Lastname_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 nis odd, the median is the middle entry. In a list named data this will be element data[(n - 1) // 2] . Note the use of // to do integer division. Ifnis even the median is the average of the numbers surrounding the middle. For a list named data, this is (data[(n // 2)1 + data[(n // 2) - 1]) / 2.9. 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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Theory And Application Bio Science And Bio Technology International Conferences DTA And BSBT 2011 Held As Part Of The Future Generation In Computer And Information Science 258

Authors: Tai-hoon Kim ,Hojjat Adeli ,Alfredo Cuzzocrea ,Tughrul Arslan ,Yanchun Zhang ,Jianhua Ma ,Kyo-il Chung ,Siti Mariyam ,Xiaofeng Song

2011th Edition

3642271561, 978-3642271564

More Books

Students also viewed these Databases questions

Question

you have a powerbi data model that contains two tables

Answered: 1 week ago

Question

Effective Delivery Effective

Answered: 1 week ago