You can download this code by clicking the button below.
This code is now available for download.
This function takes a list of words as an argument and returns a new list with the words sorted based on their length.
Technology Stack : Built-in libraries
Code Type : Function
Code Difficulty : Beginner
def sort_words(words):
"""
Sorts a list of words based on the number of letters in each word.
"""
return sorted(words, key=len)