Search engine challenge python | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Search engine challenge python

What's wrong with this code? text = input() word = input() def search(text,word): if word in text: return("Word found") else: return("Word not found") print(search(text,word))

9th May 2021, 12:20 PM
Tasnas123
Tasnas123 - avatar
3 Answers
+ 7
text = input() word = input() def search(text,word): text = text.split(' ') if word in text: return("Word found") else: return("Word not found") print(search(text, word)) Just split the text.
9th May 2021, 12:28 PM
Kǟrɨsɦmǟ ❥
Kǟrɨsɦmǟ ❥ - avatar
+ 4
Tasnas123 Ohh sorry that's my mistake actual at last print statment that indentation is unwanted. So here goes ur code: text = input() word = input() def search(text,word): text = text.split(' ') if word in text: return("Word found") else: return("Word not found") print(search(text, word))
9th May 2021, 1:56 PM
Kǟrɨsɦmǟ ❥
Kǟrɨsɦmǟ ❥ - avatar
+ 2
I copied your code, but it still doesn't work😓
9th May 2021, 1:40 PM
Tasnas123
Tasnas123 - avatar