0

Need help explaining why this doesn't work for the final 100 points bonus question for Python for Beginner course.

This is the code I have, not sure why this doesn't work... Anyone would be willing to shed some light? Thanks Problem #45 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 ----------------------- #My code below text = input() word = input() def search(text,word): if word in text: print ('Word found') else: print ('Word not found') print (search (text,word))

26th Apr 2021, 1:34 AM
k2hawk 10
k2hawk 10 - avatar
5 Respostas
+ 1
k2hawk 10 Try this: def seacrh(text,word) : if word in text : print ('Word found') else: print('Word not found') text = input() word = input() seacrh(text,word)
27th Apr 2021, 9:58 PM
❤️😍Prerana😍❤️
❤️😍Prerana😍❤️ - avatar
+ 3
Oh, ya just use; search(text, word) or return the values from the function instead of printing them in the function.
26th Apr 2021, 1:44 AM
ChaoticDawg
ChaoticDawg - avatar
+ 1
Check your output strings! Case matters, punctuation matters, etc. Must match 100% "Word Found" != "Word found" "Word Not Found" != "Word not found"
26th Apr 2021, 1:36 AM
ChaoticDawg
ChaoticDawg - avatar
+ 1
LoL thank you! ChaoticDawg
26th Apr 2021, 1:45 AM
k2hawk 10
k2hawk 10 - avatar
0
ChaoticDawg thanks, I tried that it's doesn't work still. The last print(search(text,word)) seems to be giving me trouble. Any other suggestions? Test #1 output expects "Word found" But my output came out to be (two outputs) Word found None
26th Apr 2021, 1:43 AM
k2hawk 10
k2hawk 10 - avatar