python-dev avatar

Python Program to Sort Words in Alphabetic Order

python-dev

Published: 22 Mar 2020 › Updated: 22 Mar 2020Python Program to Sort Words in Alphabetic Order

Python Program to Sort Words in Alphabetic Order

# Program to sort alphabetically the words form a string provided by the user

my_str = "Hello this Is an Example With cased letters"

# To take input from the user
#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

print("The sorted words are:")
for word in words:
   print(word)

Leave Python Program to Sort Words in Alphabetic Order to:

Written by

Read more #python-dev posts


Best Posts From python-dev

We have not curated any of python-dev's posts yet. But you can encourage our curation team to review posts by visiting them regularly and by referring other readers. Because we give priority to frequently read content.

More Posts From python-dev