Appendix H — The statistics Module

The statistics module contains statistical related functions, such as measures of central tendency:

from statistics import mean, median, mode

my_nums = [1, 2, 2, 3, 4, 6, 7, 8, 9]

print(mean(my_nums))

print(median(my_nums))

print(mode(my_nums))
4.666666666666667
4
2