0

Pyton help me?

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

20th Jun 2022, 4:06 AM
Siroj Quziboyev
Siroj Quziboyev - avatar
5 Answers
+ 3
The main code is calling the function using undefined variables as arguments to the search function. Move the input lines to outside of the function. def search(text, word): if word in text: return "Word found" else: return "Word not found" text = input() word = input() print(search(text, word))
20th Jun 2022, 4:25 AM
Brian
Brian - avatar
+ 2
Your code starts at the last line. That line calls the function. In the call you use two variables. But text and word have no value at that point.
20th Jun 2022, 4:28 AM
Paul
Paul - avatar
+ 1
def search(text, word): text = input() word = input() text = text.split(): if word in text: return "Word found" else: return "Word not found" print(search(text, word)) I hope this helps😊
20th Jun 2022, 5:24 AM
EmmzyCodez
EmmzyCodez - avatar
0
def search(text, word): text = input() word = input() if word in text: return "Word found" else: return "Word not found" print(search(text, word))
20th Jun 2022, 4:07 AM
Siroj Quziboyev
Siroj Quziboyev - avatar
0
Where has mistake got?
20th Jun 2022, 4:08 AM
Siroj Quziboyev
Siroj Quziboyev - avatar