Sorting Strings by Second Part

  • Share this:

Code introduction


This function takes a list of strings, where each string consists of two parts separated by a comma. The function sorts the list of strings based on the second part.


Technology Stack : List comprehension, lambda function

Code Type : Sort function

Code Difficulty : Intermediate


                
                    
def aord(str_list):
    return sorted(str_list, key=lambda x: x[1])