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))
4 Respuestas
+ 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.
+ 2
Thank you, я не внимателен, но программа все равно не выдаёт нужный ответ
+ 2
Роман Андреевич Невзоров
Please re-read my previous answer. I was editing it to add corrections when you posted.
+ 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!!