+ 3

How to do this in Python ?

You’re working on a search engine. Watch your back Google! 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. Sample Input "This is awesome" "awesome" Sample Output Word found

5th Feb 2021, 7:08 PM
Layth
Layth - avatar
61 Respuestas
+ 71
def seacrh(text,word) : if word in text : print ('Word found') else: print('Word not found') text = input() word = input() seacrh(text,word)
5th Feb 2021, 10:33 PM
Vasiliki B.
Vasiliki B. - avatar
+ 33
text = input() word = input() def search(text,word): if(word in text): return "Word found" else: return "Word not found" print(search(text, word))
12th Mar 2021, 6:49 PM
Syed Fahad Ahmed
Syed Fahad Ahmed - avatar
+ 23
why it always show me "word found none" and its not working what should i do
31st May 2021, 6:40 PM
Dev Saxena
+ 8
def search(text,word) : if word in text : print ('Word found') else: print('Word not found') text = input() word = input() search(text, word) don't forget the indentation
7th Feb 2021, 6:49 AM
Ronny Karani
Ronny Karani - avatar
+ 2
The error occurred simply because you forgot indentation in your code .
5th Feb 2021, 10:34 PM
Vasiliki B.
Vasiliki B. - avatar
+ 2
Ok thanks !
6th Feb 2021, 4:34 AM
Layth
Layth - avatar
+ 2
text = input() word = input() def search(text,word): if(word in text): return "Word found" else: return "Word not found" print(search(text, word))
6th Apr 2021, 8:11 AM
Nimma Bhavana
Nimma Bhavana - avatar
+ 2
It is because you are having two print statements to fix this instead of: print(search(text, word)) try: search(text, word)
23rd Jun 2021, 5:12 PM
Rares-Vasile Irimus
Rares-Vasile Irimus - avatar
+ 2
def search(text,word): if(word in text): return "Word found" else: return "Word not found" Try it
31st Jan 2022, 1:50 AM
Avrian Shandy
Avrian Shandy - avatar
+ 1
When I write if word in text : print ("Word found") it gives error
5th Feb 2021, 7:41 PM
Layth
Layth - avatar
+ 1
It's just I forget indentation
16th Feb 2021, 1:27 PM
Layth
Layth - avatar
+ 1
def seacrh(text,word) : if word in text : print ('Word found') else: print('Word not found') text = input() word = input() seacrh(text,word)
16th Feb 2021, 1:39 PM
Layth
Layth - avatar
+ 1
2nd Mar 2021, 11:49 PM
Benjamin Jürgens
Benjamin Jürgens - avatar
+ 1
Please kindly help with this coding problem, every time you enter print the output is an error
20th Apr 2021, 10:18 PM
Andrew Malenga
Andrew Malenga - avatar
+ 1
1st May 2021, 11:17 AM
sonu shejwal
sonu shejwal - avatar
+ 1
You’re working on a search engine. Watch your back Google! 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. Sample Input "This is awesome" "awesome" Sample Output Word found answer is def seacrh(text,word) : if word in text : print ('Word found') else: print('Word not found') text = input() word = input() seacrh(text,word) for all doubt solving contact on this by telegram https://youtu.be/tOWQqOWieE4
17th Nov 2022, 10:45 AM
RAJVEER SINGH BAIRWA
RAJVEER SINGH BAIRWA - avatar
+ 1
You’re working on a search engine. Watch your back Google! 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. Sample Input "This is awesome" "awesome" Sample Output Word found answer is def seacrh(text,word) : if word in text : print ('Word found') else: print('Word not found') text = input() word = input() seacrh(text,word) for all doubt solving contact on this by telegram https://youtu.be/tOWQqOWieE4
17th Nov 2022, 10:47 AM
RAJVEER SINGH BAIRWA
RAJVEER SINGH BAIRWA - avatar
+ 1
def seacrh(text,word) : if word in text : print ('Word found') else: print('Word not found') text = input() word = input() seacrh(text,word) for all doubt solving contact on this by telegram https://youtu.be/tOWQqOWieE4
17th Nov 2022, 10:50 AM
RAJVEER SINGH BAIRWA
RAJVEER SINGH BAIRWA - avatar
0
Yes , because I have edited the code 😅
16th Feb 2021, 1:32 PM
Layth
Layth - avatar