+ 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")

7th Apr 2021, 8:28 AM
Sajjad Samiei naserani
Sajjad Samiei naserani - avatar
6 ответов
+ 3
Jorji Sali If word in text then how word not in text?
7th Apr 2021, 8:47 AM
A͢J
A͢J - avatar
+ 3
Jorji Sali There should be def search (): if word in text: print("Word found") else: print("Word not found") search ()
7th Apr 2021, 8:56 AM
A͢J
A͢J - avatar
+ 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.
7th Apr 2021, 8:30 AM
Sajjad Samiei naserani
Sajjad Samiei naserani - avatar
+ 1
You didn't call the function.
7th Apr 2021, 8:41 AM
Vadivelan
+ 1
functionname() - to call function. Here, search()
7th Apr 2021, 8:50 AM
Vadivelan
0
How to call it?
7th Apr 2021, 8:42 AM
Sajjad Samiei naserani
Sajjad Samiei naserani - avatar