The math.dist() function calculates the Euclidean distance between two points in a given space.


Where, parameters p and  q  are iterables representing the first point  and the second point in two-dimensional space, respectively.

This function returns the Euclidean distance between two points. The value returned is roughly equivalent to: sqrt(sum((px - qx) ** 2.0 for px, qx in zip(p, q)))

import math 

print(math.dist((4, 7), (3, 12)))
print(math.dist([9, 5, 4], [1, 2, 4]))
print(math.dist((1.5, 2.5), (3.1, 4.5)))