[SOLVED] What is the problem here? Nearly there. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

[SOLVED] What is the problem here? Nearly there.

I did this for the Search Engine(below)coach code solution but it keeps on returning:- "Word Found" "None" What is happening? My attempt:- text = input() word = input() def search(text,word): if word in text: print("Word found") else: print("Word not found") print(search(text, word))

22nd Feb 2021, 4:06 PM
Kanji-50
Kanji-50 - avatar
3 Answers
+ 3
Your function is not returning anything, thus returning NONE which what your last print() is printing. The first output is because of print() in the function itself there are a lot of ways to fix it Here's one of them👇 https://code.sololearn.com/cFnb6IdHp8un/?ref=app
22nd Feb 2021, 4:11 PM
Arsenic
Arsenic - avatar
+ 1
Thank you Arsenic 👍
22nd Feb 2021, 4:13 PM
Kanji-50
Kanji-50 - avatar
+ 1
Replace the print with return and your code works fine👍
23rd Feb 2021, 8:31 AM
∆BH∆Y
∆BH∆Y - avatar