Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

import math def getAverage ( mylist ) : This function computes the average of a list of numbers. Parameters - - -

import math
def getAverage( mylist ):
"""
This function computes the average of a list of numbers.
Parameters
----------
mylist : list of int
One dimensional list of integers you will find the average of
Returns
-------
float
The average of the integers in the list
"""
pass
def getStandardDeviation( mylist ):
avg = getAverage( mylist )
"""
This function computes the standard deviation in a list of numbers.
Parameters
----------
mylist : list of int
One dimensional list of integers you will find the standard deviation of
Returns
-------
float
The standard deviation of the integers in the list.
"""
pass
def getResults( data_list, stat_results ):
"""
This function creates a two-dimensional list stored in the parameter
stat_results. Each sublist will contain two entries: the average and the
standard deviation for each corresponding sub-list in data_list.
Parameters
----------
data_list : list of int
Two dimensional list of integers you will find the average and standard
deviation of
stat_results : list of float
Two dimensional list of floats which include averages and standard
deviations
Returns
-------
None
"""
passTwo lists have been declared for you. values is a 2D list of integer values. You can change the numbers in the values, but the solution provided below is for the default numbers provided in the notebook template. results is a 2D list consisting of the average and sample standard deviation for each row in the values list. For example, the first row in results will have the average and sample standard deviation for the first row in values. To start, results is an empty list.
Complete the getAverage function that takes in a list of values as its parameter mylist. mylist is intended to be a row within a 2D list of integers for this program. The function will compute the average and return it. Most of this function has been completed for you.
Complete the getStandardDeviation function. It takes in a list of values as its parameter mylist. The function will need to call getAverage. The function will compute the standard deviation and return it. If the length of the list is less than 2, return a -999 in it. The formula for the sample standard deviation is:
=1()21
Complete the getResults function. It takes in a 2D list of integers data_list and an empty list stat_results as its parameters. The function will go through each sub-list in data_list and get the average and the standard deviation and append it to the stat_results list. stat_results will be a 2D list with each sub-list including two elements: average and standard deviation for the corresponding sub-list in data_list. See below for an example.
Function comments have been added for you.

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

Essential SQLAlchemy Mapping Python To Databases

Authors: Myers, Jason Myers

2nd Edition

1491916567, 9781491916568

More Books

Students also viewed these Databases questions