0
Search Engine
Hii guys a suggestion for that thaanx ! 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 Define the search () function, so that the given code works as expected.
3 ответов
+ 1
Try to define the search() function as follows:
def search(text, word):
if word in text:
return "Word found"
else:
return "Word not found"
This function first checks if the "word" is in the "text" using the "in" operator. If it's true, the function returns (Word found). Otherwise, it returns (Word not found).
+ 1
text = input()
word = input()
def search(text,word):
if word in text:
return("Word found")
else:
return("Word not found")
print(search )
Try this it will work
0
It doesn’t work guys sololearn already put in the code this :
print(serch(text, word))