Question: Write a Python code which takes a sentence as an input, e.g., sentence = this is a long sentence, and returns the list of words,

Write a Python code which takes a sentence as an input, e.g., sentence = this is a long sentence,

and returns the list of words, sorted in the order by word length, e.g., [(1, a), (2, is), (4, long), (4, this), (8, sentence)].

You may use list.sort() or sorted() functions for sorting.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!