Answer to Question #318559 in Python for Kesavan

Question #318559

You’re working on a search engine. Watch your back Google!



The given code takes a text and a word as input and passes them to a function called search().



The search() function should return "Word found" if the word is present in the text, or "Word not found", if it’s not.



Sample Input


"This is awesome"


"awesome"



Sample Output


Word found

1
Expert's answer
2022-03-26T12:41:20-0400

The following program returns the required output:

# search engine
def search(text, word):
    """Search engine"""
    # look whether the word is in the text provided
    if word in text:
        print('Word found')
    else:
        print('Word not found')

text = input()
word = input()
search(text, word)

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

Farhan Ahmed
13.10.23, 12:48

It's good website

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS