3. Summary statistics

Summary Statistics Lab

So far, we have written functions which transform values into values (lab 0), lists into lists (labs 1 and 2), and lists into values (lab 2). This last kind of function is particularly useful for describing large amounts of data.

Summary statistics are functions which transform lists of numbers into single numbers which describe the values in the list. Using a single number to describe a bunch of data sounds convenient, but which number best provides the best description? In this lab, we are going to implement a number of different summary statistics.

Your challenge is to implement the following functions. Starter code is provided for each in sumstats.py. Tests for each function are provided in test_sumstats.py, which you can run using python test_sumstats.py (make sure you’re in a poetry shell first!)

It is highly recommended to write pseudocode before starting in on coding.

  • mean
  • median
  • mode
  • variance
  • standard_deviation