The mean or average when the context is clear, is the sum of a collection of numbers divided by the number of numbers in the collection. A=(a1+a2+...+an)\n
import numpy as np
sal=np.array([22,24,27,31,31,31,32,32,32,32,44,45,48,53,55,60,70,80,80,110,150,300]) #create list of workers income
sal
l=0 #sum of a elements of array
n=0 #number of elements in array
m=0 #mean
for i in sal:
l=l+i
n=n+1
m=l/n
print(' sum of all elements of array:',l,'\n number of elements in array:',n,'\n mean:',m)
l=sal.sum()
n=sal.size
m=l/n
print(' sum of all elements of array:',l,'\n number of elements in array:',n,'\n mean:',m)
np.mean(sal)
%matplotlib inline
import matplotlib.pyplot as plt
plt.hist(sal )
plt.show()