7 Respostas
+ 5
Taras Ishchuk
The details provided are the challenge description.
Please attach your attempt so we may guide you
+ 8
Taras Ishchuk ,
please show us your attempt first. put your code in playground and link it here. without having seen your code it would be difficult to find out the issues you have.
thanks!
+ 3
Taras Ishchuk
create a function "search" with two arguments "text" and "word"
and use if else block to check word is present or not in the text
Example :
text="Hello world".lower()
word="hello"
if word in text:
print("Word Found")
else:
print("Word is not Found!")
this is just an hint for you and not the actual answer !
+ 2
Taras Ishchuk How about this one? :-
def search(text, word):
return "Word" + " not" * (word not in text) + " found"
print(search(input(), input()))
# Hope this helps
+ 1
Taras Ishchuk
Your code syntax was good but you did not place it inside a search() function as per challenge details.
Also your output must exactly match the output specified by the challenge.
# Create a function
def search(txt, wrd):
if wrd in txt:
print("Word found")
else:
print("Word not found!")
# Your inputs here
text = "Hello World".lower()
word = "hello"
# Call your function
search(text,word)
0
You are working on a search engine. Watch out for Google!
This code takes text and word as input and passes them to a function named search ().
The search () function should return "Word found" if the word is present in the text or "Word not found" if not present.
Sample Input Data
"This is awesome"
"awesome"
Sample Output Data
Word found
0
text="Hello world".lower()
word="hello"
if word in text:
print("Word Found")
else:
print("Word is not Found!")