Statistics Module
statistics provides common numerical summaries without an external package. Its functions still need a clear choice of population, sample, and missing-data policy.
Understand the idea
mean, median, multimode, pstdev, and stdev answer different questions. Most ordinary summaries do not silently clean invalid strings or decide whether an outlier should be removed. Treat data validation and the rationale for exclusions as separate steps. Small samples should be reported as small samples, not strong estimates of a population.
Where to try it
Open this example with Try in playground. The code loads as editable text and does not run until you select Run. The first run downloads Python. Each run starts fresh; temporary files created by a script are not files on your PC.
A worked example
from statistics import mean, median, multimode
values = [2, 2, 4, 8]
print(mean(values), median(values), multimode(values))
Read the result
The mean is 4, the median is 3.0, and the mode list is [2].
Try one change
Add a valid extreme observation and describe how each statistic reacts.