Implement select_degree(x_train, y_train, x_val, y_val, max_degree):
0..max_degree, fit a polynomial by least squares with np.polyfit(x_train, y_train, d)(best_degree, val_errors) where val_errors is a list indexed by degree. Ties go to the lower degree.Training error always falls with degree; validation error is what reveals overfitting.