You can download this code by clicking the button below.
This code is now available for download.
The function sorts the list a based on the index of elements in list b.
Technology Stack : Built-in functions: sorted, lambda expression
Code Type : Sort function
Code Difficulty : Intermediate
def aaaa(a, b):
return sorted(a, key=lambda x: b.index(x))