+ 13

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
Mohamed Mehdi Gara - avatar
38 Answers
+ 16
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
+ 14
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
+ 5
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
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
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
+ 3
Project name?
19th May 2021, 4:59 PM
❤️😍Prerana😍❤️
❤️😍Prerana😍❤️ - avatar
+ 3
Welcome Tell did it works or not
19th May 2021, 5:14 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
Ok wait
19th May 2021, 5:16 PM
❤️😍Prerana😍❤️
❤️😍Prerana😍❤️ - 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
+ 1
1. sentence=input("Enter a sentence:") 2. particular_word=input("Enter a particular word:") 3. def findin_word(sentence,particular_word): 4. if(particular_word in sentence): 5. return(particular_word + " is found in " +sentence) 6. else: 7. return("not found") 8. print(findin_word(sentence,particular_word)) It's only for knowledge.it will not work on sololearn project
10th Apr 2021, 10:57 AM
Rajinder Sharma
Rajinder Sharma - avatar