Write a program to enter a sentence. Search for word 'the' in the sentence and count the number of occurrences of 'the' in the sentence.
Example: Enter sentence: These laptop have the hard drive and the mother board
Output:
The number of occurrences of 'the' = 3
Answers & Comments
Verified answer
Answer:
def the_searcher(sentence):
sentence.lower()
count = 0
for i in sentence:
if sentence[i]=='t' and sentence[i+1]=='h' and sentence[i+2]=='e':
count+=1
return count
print(the_searcher('These laptop have the hard drive and the mother board'))
Explanation:
a python program to count the occurance of 'the' in the sentence.
mark as brainliest.