What's wrong with my search engine code? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What's wrong with my search engine code?

text = input() word = input() def search(text, word): if word in text: return ("word found") else: return ("word not found") print(search(text, word)) When I run the output is the same but it says it's wrong. Where's the problem ?

7th Jan 2023, 5:09 PM
Jonathan
Jonathan - avatar
3 Answers
+ 3
Ali M He/She is trying to Solve Code Coach practice so you should not write anything inside input function. More new lines doesn't matter. Program is right just need to check printed string which starts with capital letter. Joni Check the spelling of 'word', first character is capital.
8th Jan 2023, 2:43 AM
A͢J
A͢J - avatar
+ 5
Check the string which you have printed
7th Jan 2023, 5:10 PM
A͢J
A͢J - avatar
0
it looks fine, Joni and after checking it, it also works well ! let me give you a piece of advice... you better use the input like this.... text=input ("enter the text here, please: ") word=input ("and enter the word here: ") and don't put a lot of new lines between the function "def..." and the next line that will probably help... good luck, and peace
8th Jan 2023, 2:09 AM
Ali M
Ali M - avatar