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
Write a script to partition the string 'INSTITUTE' at the occurrence of letter 'T'.
What will be the output of the following programming code?
str = "My Python Programming" print (str[-5:-1]) print (str[1:5]) print (str[:-4]) print (str[0:]) print (str[:13-4]) print (str[:3])
Write a program to count the number of each vowel in a given string.
Write a program to remove 'i' (if any) from a string.