+ 1
help me in end project of python begginer
guys this is my solution for end project of search engine but it is not correct in all cases plz help me if u have different solution text = input() word = input() def search(x,y): if text.find(word): return "Word found" else: return "Word not found" print(search(text,word))
4 Antworten
+ 4
pardeep
def seacrh(text,word) :
if word in text :
print ('Word found')
else:
print('Word not found')
text = input()
word = input()
seacrh(text,word)
This may helps you.
Happy coding 🤘
+ 2
string.find function will return -1 if the word is not found not 0
-1 is a truth value, so you cant simply do
if string.find(otherstring):
else:
try
if string.find(otherstring) == -1:#word not found
else:#word found
or otherwise
+ 2
thanks miss
+ 1
thanks