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
>>> target_list.sort(key=lambda x: abs(number-x)) >>> target_list [2, 1, 8, 20]