Write a Python program to count the number of entered words in a given string
Refer sample input and output for formatting specification.
All float values are displayed correct to 2 decimal places.
All text in bold corresponds to input and the rest corresponds to output
Input:
1. First Line: String or sentence
2. Second Line: word to be searched in the sentence
Output:
Word Count
a=input()
b=input()
l=[]
count=0
l=a.split()
n=len(l)
for i in range (0,n):
if(l[i]==b):
count=count+1
print(count)
Comments
Post a Comment