I want to sort a list based on how close a number in the list is to a given number. so for example:
target_list = [1,2,8,20] number = 4 then probably sorted l
sorted(target_list, key=lambda k: abs(k - 4))
Or to sort the list in place:
target_list.sort(key=lambda k: abs(k - 4))