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))
4 odpowiedzi
0
Don't use input () in functions
Rather use arguments and pass the parameters outside the function from input
0
Guess this is what you're looking for ^_^
https://code.sololearn.com/cr5Gx5pEqAkA/?ref=app
- 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"
- 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...