Write a program in Python to sort all words of a sentence or string in dictionary (Alphabetical) order.

Example:

The method is very simple. We will first store the words into a python list and will use inbuilt sort() method on the newly created list to sort the words in alphabetical order.

At last, we will concatenate the words from start to end of the sorted list into a new Sentence and output it.

Let’s see its implementation in Python.

Output

If you have any doubts or suggestions then comment below.

Leave a Reply