Answered step by step
Verified Expert Solution
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 datalist, statresults :
This function creates a twodimensional list stored in the parameter
statresults. Each sublist will contain two entries: the average and the
standard deviation for each corresponding sublist in datalist.
Parameters
datalist : list of int
Two dimensional list of integers you will find the average and standard
deviation of
statresults : 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 D 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 D 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 D 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 return a in it The formula for the sample standard deviation is:
Complete the getResults function. It takes in a D list of integers datalist and an empty list statresults as its parameters. The function will go through each sublist in datalist and get the average and the standard deviation and append it to the statresults list. statresults will be a D list with each sublist including two elements: average and standard deviation for the corresponding sublist in datalist. 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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started