KnowledgeBoat Logo
|

Computer Science

Write a program that reads a line, then counts how many times the word 'is' appears in the line and displays the count.

Python

Python String Manipulation

8 Likes

Answer

line = input("Enter a line: ")
line = line.lower()
words = line.split()
count = words.count('is')
print("The word 'is' appears", count, "times.")

Output

Enter a line: The project is ambitious, and its success is dependent on how well it is managed and executed.
The word 'is' appears 3 times.

Answered By

5 Likes


Related Questions