Here’s the table of contents:

  1. 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!