+ 1
Whats wrong with this code?
text = input() word = input() def search(): for word in text: if word not in text: print("word not found") else: print("word found")
6 ответов
+ 3
Jorji Sali
If word in text then how word not in text?
+ 3
Jorji Sali
There should be
def search ():
if word in text:
print("Word found")
else:
print("Word not found")
search ()
+ 1
The given code takes a text and a word as input and passes them to a function called search().
The search() function should return "Word found" if the word is present in the text, or "Word not found", if it’s not.
+ 1
You didn't call the function.
+ 1
functionname() - to call function.
Here, search()
0
How to call it?