Python Exercise 8 Problem
In this Python exercise, write a Python program that will take the input of words (comma-separated format). Once the user provides the words, sort and print the words in alphabetical order. The data input can be in any order any words as long as the provides words are comma-separated.
Let’s take the example of the types of emotions a person may have.
Let’s take a look at this hint, if the user inputs: tornado,hurricane,tsunami,flood,thunderstorm,hail,rain,wind
Then the output should be: flood,hail,hurricane,rain,thunderstorm,tornado,tsunami,wind
Note: This exercise is completed in Python 3.7
Solution Python Exercise 8
Python Code Input:
words = input("Provide a list of words that are comma-separated: ")
words_split = [x for x in words.split(',')]
print("User input of words: ")
print("User words sorted alphabetically: ")
Provide a list of words that are comma-separated: sad,happy,mad,bad,good
Python Code Output:
User input of words:
User words sorted alphabetically: