Search engine problem | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Search engine problem

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

17th Aug 2022, 4:43 PM
Aaron ngetich
Aaron ngetich - avatar
4 Answers
+ 5
Aaron ngetich You need to read problem statement and expected output carefully. Check the expected output and your code you will understand what you missed return "Word found" else: return "Word not found" print(search(text, word))
17th Aug 2022, 5:09 PM
RšŸ’ šŸ‡®šŸ‡³
RšŸ’ šŸ‡®šŸ‡³ - avatar
+ 3
"word found" must be in capital letter W
17th Aug 2022, 5:34 PM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
+ 2
Seen it R(āœæ^ā€æ^)šŸŒ»šŸ‡®šŸ‡³ , thanks it was a typo.
17th Aug 2022, 5:23 PM
Aaron ngetich
Aaron ngetich - avatar
0
""" My code so far. """ text = input() word = input() def search (text, word ): if word in text: print("word found") else: print("Word not found") search(text, word)
17th Aug 2022, 4:52 PM
Aaron ngetich
Aaron ngetich - avatar