Write a python function that sorts a list based on the user provided list of indexes.
Topic: Write a python function that sorts a list based on the user provided list of indexes.
Solution
def sort_by_indexes(lst, indexes, reverse=False): return [val for (_, val) in sorted(zip(indexes, lst), key=lambda x: \ x[0], reverse=reverse)]
List all Python Programs