+ 1

Please tell me why there is no output, it seems like everything is correct in the code. I know it can be done easier, but I'm w

def search(text, word): text = input() word = input() text1=text.split(' ') for word1 in text1: if word == word1: return("Word found") else: return("Word not foud") print(search(text, word))

10th Oct 2022, 9:34 PM
Druahlov
1 ответ
+ 6
It’s not outputting because your print statement is in your function definition. Simply unindent it and your code will output. Also move these lines: text = input() word = input() to before your function without indentation so that your code will run without error. Happy coding 😃👍
10th Oct 2022, 10:01 PM
Jared 😉
Jared 😉 - avatar