Tuple Sorting by First Element

  • Share this:

Code introduction


Sorts a list of tuples based on the first element of each tuple and returns the sorted list.


Technology Stack : sorted, lambda expression

Code Type : Function

Code Difficulty : Intermediate


                
                    
def acesort(iterable):
    return sorted(iterable, key=lambda x: x[0])