belongs to collection: Python String Programs
Sorting:
Sorting is a process of arrangement. It arranges data systematically in a particular format. It follows some algorithm to sort data.
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:
total answers (1)
start bookmarking useful questions and collections and save it into your own study-lists, login now to start creating your own collections.
Output:
need an explanation for this answer? contact us directly to get an explanation for this answer