New submission from Raymond Hettinger <raymond.hettin...@gmail.com>:

Weighted averages are another basic that we should support.

A professor assigns a grade for a course by weighting quizzes at 20%, homework 
at 20%, a midterm exam at 30%, and a final exam at 30%:

>>> grades = [85, 92, 83, 91]
>>> weights = [0.20, 0.20, 0.30, 0.30]
>>> fmean(grades, weights)
87.6

The API here matches that for harmonic_mean() and random.choices(), the other 
places where we support optional weights.

----------
components: Library (Lib)
messages: 393751
nosy: rhettinger, steven.daprano
priority: normal
severity: normal
status: open
title: Add optional weights parameter to statistics.fmean()
type: enhancement
versions: Python 3.11

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue44150>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to