Sort List by Second Tuple Element

  • Share this:

Code introduction


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])