Computer Science, asked by pcastle9631, 1 year ago

Write a program to enter a sentence from the keyboard and count the number of times a particular word occurs in it. for_example enter a sentence:The quick brown for jump over the lazy dog. enter a word to be searched : the output : 2times

Answers

Answered by shivamDS
1

Answer: Python 3

inputSentence= input('Enter a sentence :').lower()

wordArray = inputSentence.split(' ')

SearchWord = input('Enter word to be searched').lower()

print(wordArray.count(SearchWord))

Explanation:

A python 3 implementation of above question

Similar questions