C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML
Python Program to Sort Words in Alphabetic OrderSorting: 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:
Next TopicPython Remove Punctuations from a String
|