0
Problem?? Pure false, why don,t you shoot True?
text = str(input()) word = str(input() ) palabra= False def search(text,word): palabra =word.startswith(text) if palabra==False: palabra="Word found" return palabra else: palabra="Word not found" return palabra print(search(text, word))
1 Antwort
0
guille salaberry
You are searching a word in text but startswith will just check the text start with that word or not.
So if my text is "Python is fun" and I want to find word "is" in that text so you will always get False
So to check word exist in the text you can do like this:
text = input()
word = input()
def search():
if word in text:
return "Word found"
else:
return "Word not found"
print (search())