How to do this in Python ? | Sololearn: Learn to code for FREE!

+1

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

2/5/2021 7:08:25 PM

Layth

48 Answers

New Answer

+50

def seacrh(text,word) : if word in text : print ('Word found') else: print('Word not found') text = input() word = input() seacrh(text,word)

+25

text = input() word = input() def search(text,word): if(word in text): return "Word found" else: return "Word not found" print(search(text, word))

+8

why it always show me "word found none" and its not working what should i do

+6

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

+3

The error occurred simply because you forgot indentation in your code .

+2

Ok thanks !

+2

It's just I forget indentation

+2

def seacrh(text,word) : if word in text : print ('Word found') else: print('Word not found') text = input() word = input() seacrh(text,word)

+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

Please kindly help with this coding problem, every time you enter print the output is an error

+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

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

+1

Borhan Fuad Ghaleb AL-Hammadi don't spam please

+1

+1

def serch(text,word): if word in text : print('Word found') else: print('word not found') text =input() word=input() search(text,word)

0

Yes , because I have edited the code 😅

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. Answer: text = input() word = input() def search(text,word): if word in text : return "Word found" else: return "Word not found" print(search(text, word))

0

me merca que else : esta en error