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
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))
+ 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.
+ 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đ
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))
0
Where has mistake got?