Checkpoint 11.12.1.
Create a function called
length_word
that takes in a parameter, txt
which returns a list of tuples, tup_list
, where the first element is the length of each word in txt
and the second is the word itself. Sort the list in terms of word length from longest to shortest. For example, length_word("hi bye")
would return [(3, 'bye'), (2, 'hi')]
. Note: there is one block that won't be used in the solution!