Home>Article>Backend Development> How to find the average of a list in Python

How to find the average of a list in Python

醉折花枝作酒筹
醉折花枝作酒筹 forward
2021-04-27 09:21:05 20179browse

This article introduces you to the method of finding the average of a list in Python. It has certain reference value. Friends in need can refer to it. I hope it will be helpful to everyone.

How to find the average of a list in Python

How to find the average of a list in Python

How to find the average of a list when it only contains numbers Average:

from numpy import * a = [52,69,35,65,89,15,34] b = mean(a) print(b)

Running results:

51.285714285714285

Related free learning recommendations:python video tutorial!

The above is the detailed content of How to find the average of a list in Python. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:csdn.net. If there is any infringement, please contact admin@php.cn delete