Please what is wrong in this code?
text = input() word = input() if ("word found")(search): print("word found") else: print("word not found") print(search(text, word))
Sobola Gabriel Pls don't give finished code in the answer. This is a learning app - if we don't allow the OP to write the code, we defeat learning. Always prefer giving hints to put the OP in the right direction. This allows for real learning.
The problem is lack of info in the question. Pls edit it, including: 1. A tag with the language 2. The code purpose 3. The results you found wrong Help those willing to help you.
Chiemerie Ekwueme E. Are you trying to resolve this using a function, or a simple if/else statement
The thing is you ain't using the variables you initialized in the if statement, you should have something like if text == or if text < or if word == or any condition as the case may be, that's missing in the code.
Chiemerie Ekwueme E. It's a bit clearer. Pls do the following for you to get real help, without forcing others to guess: 1. Put this explanation, about the code purpose, in the question description. Your explanation in an answer will get lost among the others. 2. Put your code in Code Playground and include a link to it (using "+" button) in the question description. This allows testing, debugging, and keeps the question updated. That said, there's two visible problems: The function call syntax in Python is 'function(arguments)', not '(arguments)(function)'; Well, no function 'search'. At least start it. Now, read about function 'split', and the test 'a in b'. This will help a lot. If you still have difficulties, first of all, follow the instructions above.
The logic in 'if' statement is not written correctly If you are doing this with a function then you need to provide the full code otherwise it leads to confusion and guesses about the functionality of your code.
Ok let me explain....... The given code should take a text and a word as input and pass 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. I hope it is clear now
text = input(); word = input(); def search(text, word): text = text.split(); if word in text: return "Word found"; else: return "Word not found"; print(search(text, word)); This should solve your question if I got you really.
Thank you sirs🙌
Python can't take two input.
Why are my users being logged as [object Object] when logging my array/user instead of giving me the values [name, age]?
JS in sololear is latest version or older? What do we use often VAR or LET and CONST?? I Have VAR is no longer used is it true??
difference in while loop
Somebody help me please 🥺
Kotlin get if Var doesn't exist