Question - Write a function to calculate the Euclidean distance between two points.
Answer -
The formula for calculating the Euclidean distance between two points (x1, y1) and (x2, y2) is as follows:
√(((x1 - x2) ^ 2) + ((y1 - y2) ^ 2))
Code for calculating the Euclidean distance is as given below:
def euclidean_distance(P1, P2):
return (((P1[0] - P2[0]) ** 2) + ((P1[1] - P2[1]) ** 2)) ** .5