Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # sort_by_paired_lists.py
- list_a = ['a4', 'b3', 'c1', 'd2']
- list_b = [4, 3, 1, 2]
- sorted_a = list(map(lambda pair: pair[1], sorted(zip(list_b, list_a))))
- print(sorted_a) # ['c1', 'd2', 'b3', 'a4']
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement