Problem: Compute the Euclidean distance between two 2-dimensional points.
Solution in Python:
import math
def compute_euclidean_distance(x1, y1, x2, y2):
"""
Author: Mayur P Srivastava
"""
dx = x2 - x1
dy = y2 - y1
return math.sqrt(dx*dx + dy*dy)
Concepts Learned: Numbers.
No comments:
Post a Comment