Sorting Strings by Length

  • Share this:

Code introduction


This function takes a list of strings as input and returns a list sorted by the length of the strings.


Technology Stack : String list, sorting

Code Type : Function

Code Difficulty : Beginner


                
                    
def sorted_names_by_length(names):
    return sorted(names, key=len)