It does not work because x.sort() is only defined for list and returns None.
new_values was the same list as values, so no difference, also brackets were missing in print and difference of new list and original list was calculated
Missing brackets in print and trapz wants function first.
y_new = y is only a reference to y, so you use the values of y and change it in y_new[i]. So the results will be false. Also you dont need to copy y. You can make an array with the len(x) e.g y_new = np.zeros(len(x)).
new plot