Implement knn_regress(X_train, y_train, X_query, k, weighted=True):
k nearest training points by Euclidean distance (ties broken by lower index)weighted=False: predict their meanweighted=True: weight each neighbour by 1 / distance. If a query exactly matches one or more training points (distance 0), predict the mean of those points' targets.