0

In the last project of the Python beginners course I am having an error in output " none ,'what should I do?

Expected output "word found' My output"word found None' Here is the code... def search (text ,word ): if word in text : k="Word found" if word not in text: k="Word not found" print (k) text = input() word = input() print(search(text, word))

2nd Aug 2022, 6:21 PM
Sabeen Fatima
2 Antworten
+ 2
Your function does not return anything, so it returns None. Either replace the 1st print() with return or remove the last print()
2nd Aug 2022, 6:29 PM
Lisa
Lisa - avatar
0
Thank you so much it worked
2nd Aug 2022, 6:32 PM
Sabeen Fatima