0
Help for this code please
text =input() word =input() def search (text,word) : if text.find(word) > 0 : print ("Word found") else : print ("Word not found") print(search (text,word)) """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"""
4 Answers
+ 3
Asked to do "Search function should return ... ". So instead of printing in function, return the string.
+ 1
It outputs for example : Word found
none
And the expected output :
Word found
+ 1
Thanks for help
0
Yes. Default return is none.
Instead of print( "Word found")
Write
return "Word found" #apply both cases