Search engine problem | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок
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 ответов
+ 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