/ Published in: Python
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
def euclidean(x,y): sumSq=0.0 #add up the squared differences for i in range(len(x)): sumSq+=(x[i]-y[i])**2 #take the square root of the result return (sumSq**0.5)