# enter code here
text=input()
word=input()
def search(text ,word):
if (text.find(word)):
print('Word found')
else:
print('Word not found')
search(text, word)
>Solution :
find method returns the index from where a word is found otherwise -1.
which means if the word is not found, text.find(word) will return -1 and -1 is truthy value. Thus the condition for if statement becomes truthy always, thus always printing word found.
So, one way to get it right is to do this;
# enter code here
text=input()
word=input()
def search(text ,word):
if (text.find(word) != -1): # only change here
print('Word found')
else:
print('Word not found')
search(text, word)