points = [(1,5), (5,8), (8,1), (9,5)]
def euclideanDistance(coordinate1, coordinate2):
return pow(pow(coordinate1[0] - coordinate2[0], 2) + pow(coordinate1[1] - coordinate2[1], 2), .5)
distances = []
for i in range(len(points)-1):
for j in range(i+1, len(points)):
distances += [euclideanDistance(points[i],points[j])]
print min(distances)
# Python Program to explain math.dist() method
# Importing math module
import math
# One dimensional Point
# Coordinate of Point P
P = 3
# Coordinates of point Q
Q = -8
# Calculate the Euclidean distance
# between points P and Q
eDistance = math.dist([P], [Q])
print(eDistance)