Q:

Write a NumPy program to calculate the Euclidean distance

0

Write a NumPy program to calculate the Euclidean distance.

From Wikipedia: In mathematics, the Euclidean distance or Euclidean metric is the "ordinary" straight-line distance between two points in Euclidean space. With this distance, Euclidean space becomes a metric space. The associated norm is called the Euclidean norm. Older literature refers to the metric as the Pythagorean metric

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

from scipy.spatial import distance
p1 = (1, 2, 3)
p2 = (4, 5, 6)
d = distance.euclidean(p1, p2)
print("Euclidean distance: ",d)

Sample Output:

Euclidean distance:  5.196152422706632

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now