You will write four functions that measure the spread of data: the mean deviation, the variance, the standard deviation and the variance of grouped data. The checker tests them on short lists, on a table with class marks, and on the difference between a whole group and a sample.
The idea. The mean deviation about a centre is the mean of the distances from it. The variance is the mean of the squared distances from the mean. For a sample, the sum of squared distances is divided by instead of . The standard deviation is the square root of the variance. For grouped data the class marks stand for the values.
Your tasks.
mean_deviation(data, about).variance(data, sample=False). Divide by n - 1 when sample is True.std_dev(data, sample=False).grouped_variance(marks, freqs) with the shortcut: the mean of the squares minus the square of the mean.Have you tried it?
Do the tasks in the editor first, and run the checker after each one. Its hints help when a check fails. When you are ready, compare your code with this solution.
Log in to join the discussion.
Loading…