0
Search engine
hello guys i'm about to finish my beginners python course i'm stuck here for several minutes this my code so far text = input() word = input() def search (text,Word): if word in text: print ("Word found") else : print ("Word not found") print(search(text, word)) please help me
9 Answers
+ 3
word=input()
text=input()
def search (text,word):
text=text.split(' ')
if word in text:
return "Word found"
else :
return "Word not found"
print(search(text, word))
+ 3
đđ
+ 1
i've taken screenshot of test area here it is
https://gyazo.com/1f75370fbd8f1259289be84c35813e58
+ 1
Make sure itâs not your code, but your upper and lower cases.
print(âWord foundâ)
else:
print(Word not foundâ)
search(text,word)
If you have lower case wâs, it will reject your answer.
I over looked it at first!
0
What is the problom here?
0
Try taking the second print statement in the else section
0
i fixed the typo still no luck here
0
Put in this for it
text = input()
word = input()
if word in text:
print ("Word found")
else :
print ("Word not found")
0
Maybe split your text into a list of words and use that? I think `x in string` only works for a single char x.