problem 4 - split sentence ask the user to type a sentence. then print each word from the sentence on a new…

problem 4 - split sentence ask the user to type a sentence. then print each word from the sentence on a new line. example: input: i love computer science output: i love computer science

problem 4 - split sentence ask the user to type a sentence. then print each word from the sentence on a new line. example: input: i love computer science output: i love computer science

Answer

Explanation:

Step1: Get user input

sentence = input("Please type a sentence: ")

Step2: Split the sentence into words

words = sentence.split()

Step3: Print each word on a new line

for word in words:
    print(word)

Answer:

The above Python - code will ask the user for a sentence, split it into words, and print each word on a new line.