Sorting Arguments by Length

  • Share this:

Code introduction


This function takes an arbitrary number of arguments and sorts them by length, returning the sorted list.


Technology Stack : Built-in function sorted(), lambda expression

Code Type : Sort function

Code Difficulty : Beginner


                
                    
def aord_by_length(*args):
    return sorted(args, key=len)