cpython: 9eb5edfcf604 (original) (raw)

--- a/Lib/statistics.py +++ b/Lib/statistics.py @@ -303,6 +303,230 @@ def _fail_neg(values, errmsg='negative v yield x +class _nroot_NS:

+

+

+

+

+

+

+

+

+

+

+

+

+ + +# This is the (private) function for calculating nth roots: +_nth_root = _nroot_NS.nth_root +assert type(_nth_root) is type(lambda: None) + + +def _product(values):

+ +

=== Measures of central tendency (averages) ===

def mean(data): @@ -331,6 +555,49 @@ def mean(data): return _convert(total/n, T) +def geometric_mean(data):

+

+

+

+

+ + def harmonic_mean(data): """Return the harmonic mean of data.

--- a/Lib/test/test_statistics.py +++ b/Lib/test/test_statistics.py @@ -1010,6 +1010,291 @@ class FailNegTest(unittest.TestCase): self.assertEqual(errmsg, msg) +class Test_Product(NumericTestCase):

+

+

+

+

+

+

+ + +class Test_Nth_Root(NumericTestCase):

+

+

+

+

+

+

+

+

+

+

+

+

+

+

+

+

+

+

+

+

+

+

+

+

+

+

+

+

+

+

+

+

+

+

+ + +class Test_NthRoot_NS(unittest.TestCase):

+

+ +

=== Tests for public functions ===

class UnivariateCommonMixin: