+ 22

Search engine project in python for beginners course

text = input() word = input() def search(text, word ): if word in text: print("Word found") else: print("Word not found") print(search(text, word)) #All test caises fail because it outputs None added to the correct output. Plz. Help.

17th Feb 2021, 11:05 AM
Mohamed Mehdi Gara
40 Answers
+ 19
With 'print' inside a function, you don't need the outside one .It prints 'none' because the function do not return a value. So, you have to remove the last print statement to avoid it. search(text,word)
17th Feb 2021, 11:17 AM
Simba
Simba - avatar
+ 18
def seacrh(text,word) : if word in text : print ('Word found') else: print('Word not found') text = input() word = input() seacrh(text,word) This will work 100%.👍
19th May 2021, 5:08 PM
❤️😍Prerana😍❤️
❤️😍Prerana😍❤️ - avatar
+ 11
text = input() word = input() def search(text, word): if word in text: print('Word found') else: print("Word not found") search(text, word) Try this
19th May 2021, 5:18 PM
❤️😍Prerana😍❤️
❤️😍Prerana😍❤️ - avatar
+ 6
Ok
19th May 2021, 5:02 PM
❤️😍Prerana😍❤️
❤️😍Prerana😍❤️ - avatar
+ 6
Mohamed Mehdi Gara But she need answer for her code
19th May 2021, 5:26 PM
❤️😍Prerana😍❤️
❤️😍Prerana😍❤️ - avatar
+ 5
How is it possible
19th May 2021, 5:38 PM
❤️😍Prerana😍❤️
❤️😍Prerana😍❤️ - avatar
+ 4
def seacrh(text,word) : if word in text : print ('Word found') else: print('Word not found') text = input() word = input() seacrh(text,word) This will work 100%.👍
18th Feb 2021, 1:40 AM
❤️😍Prerana😍❤️
❤️😍Prerana😍❤️ - avatar
+ 4
Project name?
19th May 2021, 4:59 PM
❤️😍Prerana😍❤️
❤️😍Prerana😍❤️ - avatar
+ 4
Welcome Tell did it works or not
19th May 2021, 5:14 PM
❤️😍Prerana😍❤️
❤️😍Prerana😍❤️ - avatar
+ 4
Hmm
19th May 2021, 5:42 PM
❤️😍Prerana😍❤️
❤️😍Prerana😍❤️ - avatar
+ 4
Try this: text = input() word = input() def search(text, word): #for i in word: if word in text: a ="Word found" return a else: b = "Word not found" return b print(search(text, word))
19th May 2021, 5:54 PM
❤️😍Prerana😍❤️
❤️😍Prerana😍❤️ - avatar
+ 3
Ok wait
19th May 2021, 5:16 PM
❤️😍Prerana😍❤️
❤️😍Prerana😍❤️ - avatar
+ 3
Tell did it works or not
19th May 2021, 5:21 PM
❤️😍Prerana😍❤️
❤️😍Prerana😍❤️ - avatar
+ 3
Kierren Haggerty your welcome 😃
29th Aug 2021, 2:08 AM
❤️😍Prerana😍❤️
❤️😍Prerana😍❤️ - avatar
+ 2
text = input() word = input() def search(text, word ): if word in text: print("Word found") else: print("Word not found") print(search(text, word)) please help us by this code error
6th May 2021, 2:38 PM
Tolosa Gemechu
Tolosa Gemechu - avatar
+ 2
who can tell me the last answer of this project because it is difficult
19th May 2021, 4:31 PM
ifrah abdi
ifrah abdi - avatar
+ 2
❤️😍Prerana 😍❤️ thought your code was correct and understood it so copy and pasted but it failed due to the print statement but thank you simple fix to a return statement text = input() word = input() def search(text, word ): if word in text: return "Word found" else: return "Word not found" print(search(text, word))
29th Aug 2021, 1:21 AM
Kierren Haggerty
Kierren Haggerty - 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 )) It worked for me
13th Sep 2021, 4:39 PM
Srutha Keerthi
+ 2
text = input() word = input() def search(text, word): search = word and text if word in text == search: return "Word found" else: return "Word not found" print(search(text,word)) This is also fine. It returns the appropriate value through recursion.
24th Nov 2021, 1:59 PM
Aaron Lauretani
Aaron Lauretani - avatar
+ 2
1. text = input() word = input() def search(text, word): if word in text: print("Word found") else: print("Word not found") search(text, word) 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)) Both are correct but last one is the code that sololearn actually want there from us. By the way, I was getting error that my 'W' in 'Word' was not in capital. (><)
8th May 2023, 6:07 PM
Bhagya Buch
Bhagya Buch - avatar