Python | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Python

Please I need help with this 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.

6th Apr 2022, 6:05 PM
Ofere Believe
Ofere Believe - avatar
7 Answers
+ 4
We are supposed to test of the input word is in the input text. Your if-statement doesn't make much sense. The output strings need to match the ones in the task description.
6th Apr 2022, 7:09 PM
Lisa
Lisa - avatar
+ 3
Please show your code so we can help you to find out what doesn't work!
6th Apr 2022, 6:07 PM
Lisa
Lisa - avatar
+ 2
Berve01 , as your profile shows, you have not really started a python course yet. since we need to learn the basics of python first, it is recommended to start with the tutorial *python for beginners*. without this basics, we will struggle frequently in our learning process. happy coding and good progress!
7th Apr 2022, 3:53 PM
Lothar
Lothar - avatar
+ 2
The Python for Beginners course is not listed on your profile, so we can't know. Read the task description carefully, put your code in a script on sololearn playground and share the link if you still need help
7th Apr 2022, 4:18 PM
Lisa
Lisa - avatar
+ 1
I won't spoil you the answer, but you need to declare your "search" function first. def search(word, text): # your code Then call it with the user's inputs as arguments.
6th Apr 2022, 10:05 PM
Orisa
Orisa - avatar
0
Lisa text = input() word = input() search = ("text", "word") if ("text", "word") in search: print ("word found") else: print ("word not found")
6th Apr 2022, 7:02 PM
Ofere Believe
Ofere Believe - avatar
0
Lothar I am almost done with the python for beginners course . Please check before commenting
7th Apr 2022, 4:11 PM
Ofere Believe
Ofere Believe - avatar