NumPy allowed · plain Python earns 10 bonus points
Execute a single iteration of Lloyd's algorithm for K-means clustering.
Implement kmeans_step(X, centroids): assign each point to its nearest centroid by squared Euclidean distance, then update each centroid to the mean of assigned points.
kmeans_step(X: list[list[float]], centroids: list[list[float]]) -> tuple[list[int], list[list[float]]]