What's wrong with my code? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What's wrong with my code?

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

26th Sep 2022, 2:04 PM
Snezha
Snezha - avatar
1 Answer
+ 5
A) print inside the function and remove the print() when you call the function B) replace the print() inside the function with return Make sure you understand the difference between print() and return when writing functions
26th Sep 2022, 2:10 PM
Lisa
Lisa - avatar