Oct 19, 2023
Perhaps better not to rewrite common functions yourself — reusing someone else's production solution is definitely less work, and likely to get better results.
Python's built-in statistics
module has mean
, an optimized fmean
, and both pvariance
and variance
, forcing you to decide which you really want (they are slightly different).
Details here: https://docs.python.org/3/library/statistics.html