Simple Programming

import math
def summation(l):
sum=0
for i in range(0,len(l)):
sum=sum+l[i]
return sum
def mean(l):
x=summation(l)
sum=x
return sum/len(l)
def mean_deviation(l):
y=mean(l)
sum=math.fabs(y-l[1])
for i in range (0,len(l)):
sum=sum+math.fabs(y-l[i])
return sum/len(l)
def cummulative_frequency(l):
temp=[]
temp=temp + l
#for i in range(0,len(l)):
#temp=temp + [l[i]]
#print(temp)
for i in range(1,len(temp)):
temp[i]=temp[i] + temp[i-1]
return temp
def standard_deviation(l):
x=mean(l)
sum=math.pow((l[1]-1),2)
for i in range(1,len(l)):
sum=sum + math.pow((l[i]-x),2)
return sum/(len(l)-1)
l=[1,2,3,4]
a=summation(l)
b=mean(l)
c=mean_deviation(l)
d=cummulative_frequency(l)
e=standard_deviation(l)
print("summation=",a)
print("mean=",b)
print("mean deviation=",c)
print("cummulative frequency=",d)
print("standard deviation=",e)

### Like this:

Like Loading...

*Related*