+ 3
How to do this in Python ?
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
61 Answers
+ 71
def seacrh(text,word) :
if word in text :
print ('Word found')
else:
print('Word not found')
text = input()
word = input()
seacrh(text,word)
+ 33
text = input()
word = input()
def search(text,word):
if(word in text):
return "Word found"
else:
return "Word not found"
print(search(text, word))
+ 23
why it always show me
"word found
none" and its not working what should i do
+ 8
def search(text,word) :
if word in text :
print ('Word found')
else:
print('Word not found')
text = input()
word = input()
search(text, word)
don't forget the indentation
+ 2
The error occurred simply because you forgot indentation in your code .
+ 2
Ok thanks !
+ 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))
+ 2
It is because you are having two print statements to fix this instead of:
print(search(text, word))
try:
search(text, word)
+ 2
def search(text,word):
if(word in text):
return "Word found"
else:
return "Word not found"
Try it
+ 1
When I write
if word in text :
print ("Word found")
it gives error
+ 1
It's just I forget indentation
+ 1
def seacrh(text,word) :
if word in text :
print ('Word found')
else:
print('Word not found')
text = input()
word = input()
seacrh(text,word)
+ 1
Borhan Fuad Ghaleb AL-Hammadi don't spam please
+ 1
Please kindly help with this coding problem, every time you enter print the output is an error
+ 1
+ 1
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
answer is
def seacrh(text,word) :
if word in text :
print ('Word found')
else:
print('Word not found')
text = input()
word = input()
seacrh(text,word)
for all doubt solving contact on this by telegram
https://youtu.be/tOWQqOWieE4
+ 1
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
answer is
def seacrh(text,word) :
if word in text :
print ('Word found')
else:
print('Word not found')
text = input()
word = input()
seacrh(text,word)
for all doubt solving contact on this by telegram
https://youtu.be/tOWQqOWieE4
+ 1
def seacrh(text,word) :
if word in text :
print ('Word found')
else:
print('Word not found')
text = input()
word = input()
seacrh(text,word)
for all doubt solving contact on this by telegram
https://youtu.be/tOWQqOWieE4
0
Yes , because I have edited the code 😅