Anyone knows why this is failing despite my functions passing previous tests?
Try adding print(i,j)
to see if the i and j values are reasonable.
Then try printing centroids[j] and see if that looks reasonable.
Also what does X[i] represent? Does X have one dimension or two?
Everything works fine now. Error came from ** 2 (now removed).