euclidean distance between two points python code example
Example 1: python distance of coordinates
dist = math.sqrt((x2 - x1)**2 + (y2 - y1)**2)
Example 2: distance formula in python
import math.
def calculateDistance(x1,y1,x2,y2):
dist = math.sqrt((x2 - x1)**2 + (y2 - y1)**2)
return dist.
print calculateDistance(x1, y1, x2, y2)
Example 3: euclidian function in python
import math
x = (5, 6, 7)
y = (8, 9, 9)
distance = math.sqrt(sum([(a - b) ** 2 for a, b in zip(x, y)]))
print("Euclidean distance from x to y: ",distance)