+ 5

Last question of the python for beginners 39/39

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

23rd Sep 2021, 5:12 PM
Rapmonster
Rapmonster - avatar
27 Respostas
25th Sep 2021, 4:43 PM
Pallavi Bhardwaj
Pallavi Bhardwaj - avatar
+ 5
Rapmonster Wlcm 😃 but try to solve yourself next exercise...👍
25th Sep 2021, 4:49 PM
Pallavi Bhardwaj
Pallavi Bhardwaj - avatar
+ 3
Rapmonster It must work well. You should enter the text after push enter button then enter the word and submit. Write the inputs, Input: for example some text some submit Output: word found Try and see. It will work.
23rd Sep 2021, 5:42 PM
mesarthim
mesarthim - avatar
+ 3
text = input() word = input() def search(text,word): if(word in text): return "Word found" else: return "Word not found" print(search(text, word))
24th Sep 2021, 7:39 PM
AHMAD JAZI FAISAL ALKHASONEH
AHMAD JAZI FAISAL ALKHASONEH - avatar
+ 1
Blocks are the problem Code: def search(text,word) : if word in text : print ('Word found') else: print('Word not found') text = input() word = input() search(text,word)
23rd Sep 2021, 5:32 PM
Pariket Thakur
Pariket Thakur - avatar
+ 1
Rapmonster sorry that's blocks not Bpicks 😋
23rd Sep 2021, 5:43 PM
Pariket Thakur
Pariket Thakur - avatar
+ 1
Rapmonster it should work fine what error are u getting
23rd Sep 2021, 5:45 PM
Pariket Thakur
Pariket Thakur - avatar
+ 1
Some users have reported that they currently have problems with code projects – seems to be a sololearn problem. Try again tomorrow ;)
23rd Sep 2021, 5:46 PM
Lisa
Lisa - avatar
+ 1
Vinod Nagda This link does not seem related to the thread's topic. Please remove it, this is not the right place for advertisement.
24th Sep 2021, 7:16 PM
Lisa
Lisa - avatar
+ 1
#try this code def search(text,word): for i in text: if (i==word): return("Word found") else: return("Word not found") text = input() word = input() print(search(text,word))
25th Sep 2021, 4:11 AM
Nishant Kumar
+ 1
Pallavi Bhardwaj thanks for this I tried my self and others too but It won't worked thanks for this 🥺💜
25th Sep 2021, 4:47 PM
Rapmonster
Rapmonster - avatar
+ 1
Yeahh sure I'm doing 💜😗
25th Sep 2021, 4:49 PM
Rapmonster
Rapmonster - avatar
0
Can you share your code ?
23rd Sep 2021, 5:15 PM
Abhay
Abhay - avatar
0
def seacrh(text,word) : if word in text : print ('Word found') else: print('Word not found') text = input() word = input() seacrh(text,word) Here you go
23rd Sep 2021, 5:20 PM
Rapmonster
Rapmonster - avatar
0
Check your indentation. It doesn't look right here...
23rd Sep 2021, 5:22 PM
Lisa
Lisa - avatar
0
Rapmonster In your code, there are some syntax error. Change them. Like in the function, it must be "search", but here it's written "seacrh". Happy coding!
23rd Sep 2021, 5:25 PM
mesarthim
mesarthim - avatar
0
Bpicks are the problem Code: def search(text,word) : if word in text : print ('Word found') else: print('Word not found') text = input() word = input() search(text,word) Still error dude
23rd Sep 2021, 5:34 PM
Rapmonster
Rapmonster - avatar
0
It say it's not defined code ran properly but then I get what we say in testing case
23rd Sep 2021, 5:46 PM
Rapmonster
Rapmonster - avatar
0
I'm trying this from last 2 days still ?🥲
23rd Sep 2021, 5:47 PM
Rapmonster
Rapmonster - avatar
0
# Here’s another variant: print(repr(wd := input()), "is" if wd in (txt := input()) else "is not", "in" ,repr(txt))
23rd Sep 2021, 6:12 PM
Per Bratthammar
Per Bratthammar - avatar