mean
data1=[49., 66, 24, 98, 37, 64, 98, 27, 56, 93, 68, 78, 22, 25, 11] def mean(data): return sum(data)/len(data) print mean(data1)
median
data1=[1,2,5,10,-20] def median(data): sdata = sorted(data) index = (len(data) - 1)/2 return sdata[index] print median(data1)
data1 = [1,2,5,10,-20,5,5]
def mode(data):
…
return
print mode(data1)
5
for i in range(len(data))
if :
data.count(data.[i])
data1=[1,2,5,10,-20,5,5] def mode(data): modecnt=0 for i in range(len(data)) icount=data.count(data.[i]) if icount>modecnt: mode=data[i] modecnt=icount return mode print mode(data1)