+ 1
Search engine
I am stuck on the search engine project at the end of Python for beginners. Can anyone help me by explaining it? Thanks
6 ответов
+ 2
MajesticPlatypus
Other form:
text = input()
word = input()
def search(a, b):
if b in a:
return "Word found"
else:
return "Word not found"
print(search(text, word))
😁😁
+ 1
post all the information of it here
+ 1
Thanks! I did it!
+ 1
text = input()
word = input()
def search():
if word in text:
print('Word found')
else:
print('Word not found')
search()
0
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
0
Use the 'in' operator. As in:
if <blah> in <blah>:
do stuff
MajesticPlatypus Nice!