A group of statisticians at a local college has asked you to create a set of...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
A group of statisticians at a local college has asked you to create a set of functions that compute the median and mode of a set of numbers. Define these functions in a module named stats.py. Also include a function named mean, which computes the average of a set of numbers. Each function should expect a list of numbers as an argument and return a single number. Each function should return 0 if the list is empty. Include a main function that tests the three statistical functions with a given list. Note: Mean: The "average" number; found by adding all data points and dividing by the number of data points. Example: The mean of 4, 1, and 7 is (4+1+7)/3 12/3 =4 Median: The middle number; found by ordering all data points and picking out the one in the middle (or if there are two middle numbers, taking the mean of those two numbers). Example: The median of 4, 1, and 7 is 4 because when the numbers are put in order (1, 4, 7), the number 4 is in the middle. Mode: The most frequent number-that is, the number that occurs the highest number of times. Example: The mode of (4,2, 4, 3, 2, 2}is 2 because it occurs three times, which is more than any other number. A group of statisticians at a local college has asked you to create a set of functions that compute the median and mode of a set of numbers. Define these functions in a module named stats.py. Also include a function named mean, which computes the average of a set of numbers. Each function should expect a list of numbers as an argument and return a single number. Each function should return 0 if the list is empty. Include a main function that tests the three statistical functions with a given list. Note: Mean: The "average" number; found by adding all data points and dividing by the number of data points. Example: The mean of 4, 1, and 7 is (4+1+7)/3 12/3 =4 Median: The middle number; found by ordering all data points and picking out the one in the middle (or if there are two middle numbers, taking the mean of those two numbers). Example: The median of 4, 1, and 7 is 4 because when the numbers are put in order (1, 4, 7), the number 4 is in the middle. Mode: The most frequent number-that is, the number that occurs the highest number of times. Example: The mode of (4,2, 4, 3, 2, 2}is 2 because it occurs three times, which is more than any other number.
Expert Answer:
Answer rating: 100% (QA)
Program code to copy This function will calculate the median of given list of numbers Function recei... View the full answer
Posted Date:
Students also viewed these programming questions
-
A local government agency has asked you to consult regarding acquisition of land for recreation needs for the urban area. The following data are provided: Urban population 10 years ago 49,050 Urban...
-
An economic policy research organization has asked you to study the relationship between disposable income and unemployment level. The data for this study are contained in the data file Economic...
-
The payroll clerk at Photo Workshop has asked you to create an application that displays an employees net pay. The application should allow the payroll clerk to enter the employees name, hours...
-
How can your knowledge of meat and meat cookery be used to understand protein substitutions for vegan dishes, such as tofu, texturized soy protein, grains, or beans?
-
A manufacturing company designed a factorial experiment to determine whether the number of defective parts produced by two machines differed and if the number of defective parts produced also...
-
Prepare a performance report for the dining room of Leonardos Italian Cafe´ for the month of February 2011, using the followingdata: Budgeted Data: Dining room wages.. Laundry and housekeeping....
-
Below are the financial statements for two entertainment firms, Crosby Co. and Prairie Inc. for 2017 and 2018 a. How did Crosby Co.s profit margins change from 2017 to 2018? To what would you...
-
A. H. Zehmer discussed selling a farm to Lucy. After a 40-minute discussion of the first draft of a contract, Zehmer and his wife, Ida, signed a second draft stating: We hereby agree to sell to W. O....
-
6. 7. 8. 9. You are given a converging lens with equal radii of curvature and a diverging lens with the same radii of curvature as those of the converging lens. The lenses are made of material with n...
-
Two flow control loops axe shown in the drawing. Indicate whether each system is either a feedback or a feed-forward control system. Justify your answer. It can be assumed that the distance between...
-
Axon Enterprises v. FTC (2023 What is the main outcome of this case regarding private, regulated entities or persons who seek to challenge the constitutional authority of agencies' regulatory...
-
If the Fed wants to increase the money supply, it can a. raise income tax rates. b. reduce income tax rates. c. buy bonds in open-market operations. d. sell bonds in open-market operations.
-
Over the past century, ________ has experienced particularly strong growth, and ________ has experienced particularly weak growth. a. China; the United Kingdom b. China; Canada c. the United Kingdom;...
-
According to the theory of liquidity preference, an economys interest rate adjusts a. to balance the supply and demand for loanable funds. b. to balance the supply and demand for money. c....
-
Most economists are ________ that natural resources will eventually limit economic growth. As evidence, they note that the prices of most natural resources, adjusted for overall inflation, have...
-
If the reserve ratio is and the central bank increases the quantity of reserves in the banking system by $120, the money supply increases by a. $90. b. $150. c. $160. d. $480.
-
In the following command, what goes into the position marked with x ? ? res.render ( ' " id="MathJax-Element-2-Frame" role="presentation" style="font-size: 121%; position: relative;" tabindex="0"> (...
-
The test statistic in the NeymanPearson Lemma and the likelihood ratio test statistic K are intimately related. Consider testing H 0 : = 0 versus H a : = a , and let * denote the test statistic...
-
Why will a projectile that moves horizontally at 8 km/s follow a curve that matches the curvature of Earth?
-
How does the brightness of light on a surface change when a point source of light is brought twice as far away?
-
Is it correct to say that the planets of the solar system are simply projectiles falling around the Sun?
Study smarter with the SolutionInn App