+ 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))
3 Respuestas
+ 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.
+ 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))
+ 2
I copied your code, but it still doesn't work😓