programming estimation

mean

1
2
3
4
5
6
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

1
2
3
4
5
6
7
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])

1
2
3
4
5
6
7
8
9
10
11
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)