Sort list based on second list in Python Nov 7, 2020 Here’s the table of contents: Snippet to sort list (X) based on a second list (Y) Snippet to sort list (X) based on a second list (Y) X = [3, 5, 6, 1, 2, 3, 11, 4] Y = [0, 5, 3, 2, 1, 4, 9, 22] Z = [x for _,x in sorted(zip(Y,X))] See!