0 / 34

Invite others

Progress

0 / 34

City Distance Calculator

📋 Context

You have coordinates for 4 cities and need to compute the distance matrix between all pairs. This is a common task in logistics, mapping, and machine learning (e.g., KNN).

1
2

Step 1: City Coordinates

🎯 Task

Create cities — a (4, 2) array of (x, y) coordinates:
[[0, 0], [3, 4], [6, 0], [3, -4]]
These form a diamond shape. Print it.

np.array([[0,0],[3,4],[6,0],[3,-4]])
exercise.py
⌘⏎ run · ⌘← → nav
Output
Run your code to see output here.