Python program to sort alphabetically the words form a string provided by the user

Python program to sort alphabetically the words form a string provided by the user

Answer:

my_str = input("Enter a string: ")
words = my_str.split()
words.sort()
print("The sorted words are:")
for word in words:
print(word)

Output:
Enter a string: Hello this Is an Example
The sorted words are:
Example
Hello
Is
an
this

Comments

Popular posts from this blog

Solve

Solved practical slips of 12th Computer Science journal

SOLVE QUESTION ANSWERS ON OPERATING SYSTEM .