Can you give me a correct code or correction my code. Because i dot know how make a search engine | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Can you give me a correct code or correction my code. Because i dot know how make a search engine

def search (text,word): text = str(input("this is awesome")) word = str(input("awesome") ) if word is present in the text: print("word found") else word is not present in the text: print("word not found") print(search(text, word))

9th Jul 2021, 5:56 AM
Christopher Bernard Wintara
5 Answers
+ 2
Hint: Use the inputs outside the function Then use split function inside the function along with if else statement Try it once again!!
9th Jul 2021, 10:12 AM
Aysha
Aysha - avatar
0
Don't use input () in functions Rather use arguments and pass the parameters outside the function from input
9th Jul 2021, 6:18 AM
Sudo
Sudo - avatar
0
Guess this is what you're looking for ^_^ https://code.sololearn.com/cr5Gx5pEqAkA/?ref=app
9th Jul 2021, 12:17 PM
Sudo
Sudo - avatar
- 1
first you not need anything as input argument in code coaches /:practices context... second, your conditions are not valid python... else doesn't take condition, and testing if "word is present in the text" must be written "word in text"
9th Jul 2021, 6:02 AM
visph
visph - avatar
- 1
your function body must be indented: def search(text,word): # inside function if condition: # inside condition true else: # inside else # ouside function and if you print function call, then you mist return a value from it... or you can just call function and print inside it...
9th Jul 2021, 10:30 AM
visph
visph - avatar