Created
January 17, 2017 03:35
-
-
Save bentrevett/b5b2372b2604814f881dc99bc18ba99e to your computer and use it in GitHub Desktop.
Find Euclidean distance in one line in Python.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
euclidian = lambda v1,v2: (sum([(a-b)**2 for a,b in zip(v1,v2)])**0.5) | |
print(euclidian([0.4,0.2,0.3],[0.5,0.6,0.7])) #0.574456264654 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment