Write a program to read a sentence which is a single string. Then count the number of words in the sentence. The program will read in a string not one character at a time. Output: Enter the sentence : How are you The total count of words is : 3

Respuesta :

Answer:

The program in Python is as follows:

sentence = input("Sentence: ")

words = len(sentence.split())

print("Words:", words)

Explanation:

This reads the sentence for the user

sentence = input("Sentence: ")

This counts the number of words

words = len(sentence.split())

This prints the number of words

print("Words:", words)

ACCESS MORE
EDU ACCESS