Python program to compute distance between two points


Topic: Python program to compute distance between two points

Solution

def points(x1, x2):
    import math
    p1 = list(x1)
    p2 = list(x2)
    distance = math.sqrt(((p1[0] - p2[0]) ** 2) + ((p1[1] - p2[1]) ** 2))
    print(distance)
points((2, 3), (4, 5))



List all Python Programs