Python Beginner | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Python Beginner

what is the problem here and how can i fix it text = input() word = input() def search(text, word): if word in text: print("Word found") else: print("Word not found") print(search(text, word))

6th Mar 2023, 5:13 PM
Elif Özhan
2 Answers
+ 7
Your function does not return anything. Either replace all print() int the function with "return" or remove the very last print()
6th Mar 2023, 5:41 PM
Lisa
Lisa - avatar
+ 7
Elif Özhan , https://code.sololearn.com/cqTbh687Pm7g/?ref=app Since you used print in the last line of your code...it's better return the values in conditions...
6th Mar 2023, 5:45 PM
Riya
Riya - avatar