Sorting Arguments by Length

  • Share this:

Code introduction


This function takes an arbitrary number of arguments and returns a list sorted by length.


Technology Stack : Built-in functions, sorting, variable arguments

Code Type : Sort function

Code Difficulty : Beginner


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