+ 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.
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)
+ 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%.👍
+ 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
+ 6
Ok
+ 6
Mohamed Mehdi Gara
But she need answer for her code
+ 5
How is it possible
+ 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%.👍
+ 4
Project name?
+ 4
Welcome
Tell did it works or not
+ 4
Hmm
+ 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))
+ 3
Ok wait
+ 3
Tell did it works or not
+ 3
Kierren Haggerty your welcome 😃
+ 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
+ 2
who can tell me the last answer of this project because it is difficult
+ 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))
+ 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
+ 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.
+ 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. (><)