python sort by values then sort another list the same exact way code example
Example: sort a list by values of another one python
numbers = [1, 2, 3]
letters = ['c', 'a', 'b']
#The numbers array sorted by the letters order
sorted_list = [number for letter, number in sorted(zip(letters, numbers))]
print(sorted_list)
#prints: [2, 3, 1]