0

Where is a mistake? Не могу понять в чем ошибка при выполнении последнего задания по кодингу Поисковая система

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

25th Jun 2021, 4:14 PM
Роман Андреевич Невзоров
Роман Андреевич Невзоров - avatar
4 ответов
+ 6
Your else output should be; return "Word not found" not print("Word is not found") the if; return "Word found" The expected outputs must match exactly what is expected. Both the if and the else should be returning the strings not printing them within the function, as it will currently return None outputting that as well.
25th Jun 2021, 4:26 PM
ChaoticDawg
ChaoticDawg - avatar
+ 2
Thank you, я не внимателен, но программа все равно не выдаёт нужный ответ
25th Jun 2021, 4:31 PM
Роман Андреевич Невзоров
Роман Андреевич Невзоров - avatar
+ 2
Роман Андреевич Невзоров Please re-read my previous answer. I was editing it to add corrections when you posted.
25th Jun 2021, 4:34 PM
ChaoticDawg
ChaoticDawg - avatar
+ 2
Great!!!! def search(text, word): if word in text: return "Word found" else: return "Word not found" text = input() word = input() print(search(text, word)) Thank you very much!!
25th Jun 2021, 6:50 PM
Роман Андреевич Невзоров
Роман Андреевич Невзоров - avatar