Sort Tuples by First Element

  • Share this:

Code introduction


This function accepts a list of tuples and sorts the list based on the first element of each tuple.


Technology Stack : list comprehension, lambda expression, sorted function

Code Type : Sort function

Code Difficulty :


                
                    
def aorded_list(lst):
    return sorted(lst, key=lambda x: x[0])