Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Statistical Measures The Mean is the Average of a set of numbers. The Median denotes the value lying at the midpoint of a frequency distribution

Statistical Measures
The Mean is the Average of a set of numbers.
The Median denotes the value lying at the midpoint of a frequency distribution of observed values, such that there is an equal probability of falling above or below it.
The Mode is the value that appears most often in a set of numbers.
In the graph, shown on the next page, it would be the tallest bar in the distribution.
In the following graph, while the mean is given to you, the mode and median are not.
Your job will be to write two programs:
Write a program that will determine the mode of the following distribution.
Write a second program to determine the median of this distribution.
Please note: Your programs should be indented after the def main(): statement, except for the final statement main() at the bottom.
Distribution of annual household income in the United States
2010 estimate
perent of
Part I: Program to identify the mode
Given the graph of the distribution of incomes, the mode is visually apparent. Nonetheless, your job is to write a program that will determine which vertical bar, in the diagram, is indeed the mode.
The program should identify the particular vertical bar by indicating the name it is given in the horizontal axis.
For example, the mean value is contained int the vertical bar labeled: $70,000 to $74,999.
Your program needs to identify which bar contains the mode.
The values, of the heights of each of the bars displayed in the graph, represent what percentage of the entire distribution is contained in a particular bar.
The values of all of the bars, starting from the left, are contained in the file, FamilyIncome.txt. Were you to add up all the values (which represent the percentage of the population earning in each of the $5000 ranges indicated) in this distribution, you would see that they all add up to 100, or 100%.
Be sure that you test to see that the data file, FamilyIncome.txt, is indeed present.
Call your program: myname_FinalA.py, where myname should be replaced by your own name.
Part 2: Program to identify the median
The median identifies the halfway point in the distribution.
There should be as many entries smaller than the median as there are entries larger than the median.
The program should identify the particular vertical bar, which includes the median value, by indicating the name it is given in the horizontal axis.
For example, the mean value is contained int the vertical bar labeled: $70,000 to $74,999.
Your program needs to identify which bar contains the median value.
If you were to sum the heights of all the bars up to and including the median, you should find that the sum would just exceed 50% of the total value (which again is 100% with the addition of that bar which contained the median. The bar which causes the sum to equal or exceed 50 will be the bar containing the median.
Be sure to test to see that your data file, FamilyIncome.txt, is present.
Call your program: myname_FinalB.py, where myname should be replaced by your own name.
this is whats inside the file
3.5
4.2
5.9
6.1
5.8
5.7
5.2
5
4.8
4.1
4.2
3.5
3.6
3
3.2
2.5
2.5
2.2
2.1
1.8
2.1
1.5
1.5
1.2
1.2
1
1
.9
.8
.7
.8
.6
.6
.5
.5
.4
.4
.3
.3
.2
4.6
image text in transcribed

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

Step: 3

blur-text-image

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

AWS Certified Database Study Guide Specialty DBS-C01 Exam

Authors: Matheus Arrais, Rene Martinez Bravet, Leonardo Ciccone, Angie Nobre Cocharero, Erika Kurauchi, Hugo Rozestraten

1st Edition

1119778956, 978-1119778950

More Books

Students also viewed these Databases questions

Question

Explain why Sheila, not Pete, should make the selection decision.

Answered: 1 week ago