Showing posts with label python sort words. Show all posts
Showing posts with label python sort words. Show all posts

Saturday, 23 December 2017

Python Program to Sort Words in Alphabetic Order


Code:

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:

Execute and get the output.


More Python Programs:



















100+ Best Home Decoration Ideas For Christmas Day 2019 To Make Home Beautiful

Best gifts for Christmas Day | Greeting cards for Christmas Day | Gift your children a new gift on Christmas day This Christmas d...