Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Python 3; include doc strings. 1. Write a function to compute the mean ? of a li

ID: 3698763 • Letter: P

Question

Python 3; include doc strings.

1. Write a function to compute the mean ? of a list of integers L of length n Tn Motivation: we are assuming that cach clement of L occurs w ith equal probability so we are weighting cach one by TL 2. Write a function to compute the variance V of a list of integers L of length n: V= TI, Tn This measures the spread or dispersion of the data. 3. Write a function to compute the standard deviation D of a list of intcgers L; if the variance of L is V then the standard deviation is

Explanation / Answer

def mean(L): ''' function to calculate and return mean of a list of integers :param L:list of integers :return: mean of the integers in L ''' return sum(L)/len(L) def variance(L): ''' function to calculate Variance of a list of integers :param L: list of integers :return: Variance of the integers in L ''' s=0 mu=mean(L) for i in L: s=s+(i-mu)**2 return s/len(L) def standardDeviation(L): ''' function to calculate standard deviation of a list of integers :param L: list of integers :return: standard deviation of integers in L ''' return (variance(L))**(.5)