p – Point one.
q – Point Two.
The two points should be of the same dimensions.
- The dist() function of Python math module finds the Euclidean distance between two points.
- Euclidean distance between the two points is given by
# Example Python program to find the Euclidean distance between two points
# Define point1
point1 = (2, 2);
# Define point2
point2 = (4, 8);
# Find the Euclidean distance
euclidean_distance = math.dist(point1, point2);
# Print the Euclidean distance
print("The Euclidean distance between point1(%s) and point2(%s):"%(point1, point2));
The Euclidean distance between point1((2, 2)) and point2((4, 8)):