import numpy as np N=5 x = np.array([10,40,50,30,90]) D=np.zeros(N) ave = np.sum(x)/5 for i in range (N): D[i] = 50-(ave-x[i])/2 print(D)