Last question of the python for beginners 39/39 | Sololearn: Learn to code for FREE!

+4

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

9/23/2021 5:12:12 PM

Rapmonster

27 Answers

New Answer

+4

https://code.sololearn.com/cOdKzKq2k5oF/?ref=app

+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))

+2

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.

+2

Rapmonster it should work fine what error are u getting

+2

Rapmonster Wlcm 😃 but try to solve yourself next exercise...👍

+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)

+1

Rapmonster sorry that's blocks not Bpicks 😋

+1

Some users have reported that they currently have problems with code projects – seems to be a sololearn problem. Try again tomorrow ;)

+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.

+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))

+1

Pallavi Bhardwaj thanks for this I tried my self and others too but It won't worked thanks for this 🥺💜

+1

Yeahh sure I'm doing 💜😗

0

Can you share your code ?

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

0

Check your indentation. It doesn't look right here...

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!

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

0

It say it's not defined code ran properly but then I get what we say in testing case

0

I'm trying this from last 2 days still ?🥲

0

# Here’s another variant: print(repr(wd := input()), "is" if wd in (txt := input()) else "is not", "in" ,repr(txt))