Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #97119

Re: Problem to calculate the mean in version 3.4

From Paul Rubin <no.email@nospam.invalid>
Newsgroups comp.lang.python
Subject Re: Problem to calculate the mean in version 3.4
Date 2015-09-25 00:12 -0700
Organization A noiseless patient Spider
Message-ID <87eghnas6y.fsf@jester.gateway.sonic.net> (permalink)
References <mailman.163.1443164128.28679.python-list@python.org>

Show all headers | View raw


Michel Guirguis <guirguismichel@yahoo.co.uk> writes:
>>>> mean([1, 2, 3, 4, 4])
> Traceback (most recent call last):...
> NameError: name 'mean' is not defined

Before you can use that function, you have to import the statistics
module, e.g.:

    >>> import statistics
    >>> statistics.mean([1,2,3,4,4])   

or

    >>> from statistics import mean
    >>> mean([1,2,3,4,4])

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: Problem to calculate the mean in version 3.4 Paul Rubin <no.email@nospam.invalid> - 2015-09-25 00:12 -0700

csiph-web