The Python standard library module 'statistics' has a "mean" function.

On Thu, Dec 26, 2019, 08:54 Kemal Diri <kemal.d...@sewan.fr> wrote:

> Hello,
>
> I think it would be nice to introduce an avg method for lists as a
> built-in function in python3.
> To get average of the list, I need to use some libs (eg numpy).
> In my opinion, if I can get *sum* of the list, I should get *avg *also in
> a same way.
>
> For ex [python3]:
>
> >>> l = [5, 9, 7,]
> ...
> ... import numpy as np
> ... print(np.mean(l))
> 7.0
> >>> sum(l) / len(l)
> 7.0
> >>> avg(l)
> Traceback (most recent call last):
>   File "<input>", line 1, in <module>
> NameError: name 'avg' is not defined
>
> Cordialement/Regards
> Kemal DIRI
>
>
>
>
> _______________________________________________
> Python-ideas mailing list -- python-ideas@python.org
> To unsubscribe send an email to python-ideas-le...@python.org
> https://mail.python.org/mailman3/lists/python-ideas.python.org/
> Message archived at
> https://mail.python.org/archives/list/python-ideas@python.org/message/NQB6VU6QSC253JT2SWUO3IWCZ3IG36XP/
> Code of Conduct: http://python.org/psf/codeofconduct/
>
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/5CL3KMVV3O5MM55B5XS3YCLLKFJY6CS7/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to