A delivery company wants to split its customers between two depots, A and B. Each row of points is one customer's position, and centre_a and centre_b are the two depots' positions. Every position has the same number of coordinates.
It does this in two steps:
A.Task: write two_centres(points, centre_a, centre_b) and return a dict:
"sides" — each customer's depot, "A" or "B", as a list in row order,"new_a" — depot A's new position, as a list with every coordinate rounded to 3 decimal places,"new_b" — depot B's new position, in the same way.One tool you'll need: a mask with one True or False per row works inside square brackets on a grid too. grid[mask] keeps the whole rows whose position is True.
There is always at least one customer.