Get the distance between two (x,y) format locations using the Pythagorean theorem

In a right triangle, (x1-x2) being the horizontal distance between the two points (The change in x) and (y1-y2) being the vertical distance between the two points (The change in y),

(x1-x2)*(x1-x2) + (y1-y2)*(y1-y2) == distance*distance. So the distance is the square root of (x1-x2)*(x1-x2) + (y1-y2)*(y1-y2).

dist = math.sqrt((x1-x2)**2 + (y1-y2)**2))

You can also used the math function hypot:

dist = math.hypot(x1-x2, y1-y2)