You can download this code by clicking the button below.
This code is now available for download.
This function takes a list of tuples containing words and their lengths and returns the list sorted by the length of the words.
Technology Stack : tuple, list, lambda expression, sorting
Code Type : Function
Code Difficulty : Intermediate
def sort_words(words):
return sorted(words, key=lambda x: x[1])