You can download this code by clicking the button below.
This code is now available for download.
This function accepts a list of tuples. It sorts the list based on the second element of each tuple.
Technology Stack : List, tuple, sorting
Code Type : Sort function
Code Difficulty :
def sort_list_by_second_element(lst):
return sorted(lst, key=lambda x: x[1])