LearnPy Hub
← NumPy problems
Hard

Distance Between Every Pair

Read n points (x y). Using broadcasting (no loops), build the n × n matrix of distances between every pair and print it rounded to 2 decimals, one row per line as lists.

Input

n, then n lines.

Output

n lists.

Sample 1

Input
3
0 0
3 4
6 8
Output
[0.0, 5.0, 10.0]
[5.0, 0.0, 5.0]
[10.0, 5.0, 0.0]

Sample 2

Input
1
5 5
Output
[0.0]
solution.py
Output appears here
Distance Between Every Pair · Python practice problem · LearnPy Hub