def distance(w, x): r = 0 for i in range(len(w)): r = r + (w[i] - x[i])*(w[i] - x[i]) r = np.sqrt(r) return r