Advertisement
here2share

# sort_list_a_by_list_b.py

Sep 8th, 2015
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.18 KB | None | 0 0
  1. # sort_list_a_by_list_b.py
  2.  
  3. X = ["t", "n", "h", "!", "y", "P", "o"]
  4. Y = [ 3,   6,   4,   7,   2,   1,   5 ]
  5.  
  6. print ''.join([x for (y,x) in sorted(zip(Y,X), key=lambda pair: pair[0])])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement