Posted By

adkatrit on 02/11/11


Tagged

distance euclidean


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

adkatrit


Euclidean Distance


 / Published in: Python
 

  1. def euclidean(x,y):
  2. sumSq=0.0
  3.  
  4. #add up the squared differences
  5. for i in range(len(x)):
  6. sumSq+=(x[i]-y[i])**2
  7.  
  8. #take the square root of the result
  9. return (sumSq**0.5)

Report this snippet  

You need to login to post a comment.