How do I calculate a mean with python?
Dave Angel
davea at davea.name
Mon Sep 16 20:50:06 EDT 2013
On 16/9/2013 19:33, William Bryant wrote:
> Hey I am new to python so go easy, but I wanted to know how to make a program that calculates the maen.
>
> List = [15, 6, 6, 7, 8, 9, 40]
> def mean():
> global themean, thesum
> for i in List:
> thecount = List.count(i)
> thesum = sum(List)
> themean = thesum / thecount
>
> Why doesn't this work?
Besides all the other comments, you also neglected calling this
function.
--
DaveA
More information about the Python-list
mailing list