Q:

Python Program to Sort Words in Alphabetic Order

belongs to collection: Python String Programs

0

Sorting:

Sorting is a process of arrangement. It arranges data systematically in a particular format. It follows some algorithm to sort data.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

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:

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Python Program to Remove Punctuation from a String... >>