Hey guys, can someone tell whats wrong in my code? Why is it outputting 'non' at the end? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Hey guys, can someone tell whats wrong in my code? Why is it outputting 'non' at the end?

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

11th Apr 2022, 4:39 PM
Liwaa Bou Hamdan
Liwaa Bou Hamdan - avatar
1 Answer
+ 7
Just use search(text, word) instead of print(search(text, word)) Your function not returning anything so defaultly it return none.
11th Apr 2022, 4:41 PM
Jayakrishna 🇮🇳