+ 1
How to make search engine using python vide
Search Engine 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. Sample Input "This is awesome" "awesome" Sample Output Word found Define the search() function, so that the given code works as expected.
7 Antworten
+ 7
# Search engine
text = input()
a = text.split()
word = input()
def search():
if word in text:
print("Word found")
else:
print("Word not found")
search()
+ 2
text = str(input())
word = str(input())
def search(text,word):
text = text.split(' ')
if word in text:
return("Word found")
else:
return("Word not found")
print(search(text,word))
very good thx
0
Jay Bhamare
Show your attempts
0
or we can do it b using for loop
text = str(input())
word = str(input())
def search(text, word):
for i in text:
if word in text:
return("Word found")
else:
return("Word not found")
break
search(text, word)
0
# Search engine
text = input()
a = text.split()
word = input()
def search():
if word in text:
print("Word found")
else:
print("Word not found")
search()