Skip to content
C

Problem 2: Calculate Pairwise Distances

Easypython

Problem Description

Write a Python program that calculates the Euclidean distance between every pair of points in a small dataset, storing the results in a distance matrix.

Input

A small list of 2D points.

Output

A distance matrix showing pairwise distances between all points.

Constraints

  • At least 4 points.

Example Input

text
[[1,1],[2,2],[8,8]]

Example Output

text
(A 3x3 matrix showing distances between each pair of the 3 points)

Concepts Covered

Euclidean distance formula, nested loops or scipy.spatial.distance.

Input (stdin)

Output

Run your code to see output here...