Python for Beginners, Code Project 45 Question. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Python for Beginners, Code Project 45 Question.

Hello everyone! I’m trying to solve the code project 45 in Python for beginners, and here’s what I have so far: def search(t, w): if w in t: print("Word found") else: print("Word not found") text = input() word = input() print(search(text, word)) Can someone help me understand what I’m doing wrong?

10th Dec 2021, 12:38 AM
Danyon
Danyon - avatar
2 Answers
+ 6
Remove print word and instead of that write return keyword. Because calling functions are used to return the value to the called function. There it is used to print the resulted value. Try it once again Best of luck 👍
10th Dec 2021, 1:00 AM
Aysha
Aysha - avatar
+ 3
Never mind! I got it. Thanks!
10th Dec 2021, 12:50 AM
Danyon
Danyon - avatar