WeCodeAcademy

Range, Variance and Standard Deviation

Two classes can have the same average mark and still be very different. Spread measures how far values sit from the middle.

  • Range: largest minus smallest.
  • Variance: the average squared distance from the mean.
  • Standard deviation: the square root of the variance, in the same units as the data.

For a sample (some of a bigger group) divide by n - 1; for a whole population divide by n. NumPy uses the population version by default, so pass ddof=1 for a sample.

Examplepython
Open in editor »
Quick check

Two sets have the same mean. Set B has the larger standard deviation. What does that tell you?

Your turn: write the code

Print the sample standard deviation of the data, rounded to 2 decimals.

Finish the quick check (and any code exercise) to complete this lesson, or mark it done yourself.

Tip: use the left and right arrow keys to move between lessons.