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...
-
1-Is it a good business strategy to have a day care center, Harley Davidson Motorcycle Dealership Sales and repair, Namaste Yoga studio, bookstore, temporary worker (day laborer) center, state prison...
-
Wegmans Food Markets and Tops Friendly Markets are the major grocery chains in the Rochester, New York, area. When Wal-Mart opened a Supercenter in one of the Rochester suburbs, experts predicted...
-
Spokane Manufacturing Co. obtained the following information from its records for the month of July: Required: 1. Prepare, in summary form, the journal entries that would have been made during the...
-
Given the information below for Mexicana Cement, Inc.: a. How much is the firms net working capital and what is the debt ratio? b. Complete a common-sized income statement, a commonsized balance...
-
Wood Cre-ations designs, manufactures, and sells modern wood sculptures. Sally Jensen is an artist for Wood Creations. Jensen has spent much of the past month working on the design of an intricate...
-
nx 1. A wave given by equation y = 1mm sin -5nt is produced in a string 100m long of mass 1 kg. 30 2. 3. What is the tension (in N) in string? x is in m & t in sec. You are trying to construct a...
-
The average grain diameter for a brass material was measured as a function of time at 650°C, which is tabulated below at two different times: (a) What was the original grain diameter? (b) What...
-
If the number of discouraged searchers increases, everything else remaining the same, then the Answer: employment rate decreases. unemployment rate increases. labour force participation rate...
-
Suppose a wave of negative animal spirits overruns the economy, and people become pessimistic about the future. To stabilize aggregate demand, the Fed could ________ its target for the federal funds...
-
Approximately what percent of U.S. workers are directly affected by the federal minimum wage? a. 1 b. 6 c. 12 d. 25
-
Why do joint ventures often fail?
-
The citizens of Rohan spend a higher fraction of their income on food than do the citizens of Gondor. The reason could be that a. Rohan has lower food prices, and the price elasticity of demand is...
-
What potential problems does a foreign investor experience in an industrial joint venture with an ex-local agent or distributor?
-
Which one of the following changes data or structure in a database? a ) ) USE MyBookshop; b ) ) SELECT name, price, price + 4 . 9 9 + 4 . 9 9 AS postedPrice FROM Books; c ) ) SELECT * * FROM Books...
-
What are the four types of poultry production systems? Explain each type.
-
Identify and describe the meaning of the term's formalization and informal.
-
Identify and explain the meaning of the term "strategy."
-
Identify and describe the major features of the Strategic Management model.
Study smarter with the SolutionInn App