Python Program to Sort Words in Alphabetic Order
Sorting:
Sorting is a process of arrangement. It arranges data systematically in a particular format. It follows some algorithm to sort data.
See this example:
- my_str = input(“Enter a string: “)
- # breakdown the string into a list of words
- words = my_str.split()
- # sort the list
- words.sort()
- # display the sorted words
- for word in words:
- print(word)
Output: