text = input()
word = input()
def search(tx, wd):
if wd in tx:
print("Word found")
else:
print("Word not found")
print(search(text, word))
Asked
Active
Viewed 78 times
-1

John Kugelman
- 349,597
- 67
- 533
- 578
-
1`search` doesn't return anything. – tkausl Oct 04 '21 at 01:32
-
Very similar to this other question: https://stackoverflow.com/questions/68900472/i-want-to-understand-which-line-of-code-outputs-none-in-the-function – smac89 Oct 04 '21 at 01:35
1 Answers
4
search
does not return anything, so when you try to print a call to search
it prints None
. You can just remove the last print function and call search
print(search(text,word)) # will print None
search(text,word) # will print "Word found" or "Word not found", no need to print again.

Andrew-Harelson
- 1,022
- 3
- 11
-
3Good answer, except that `search` returns the object `None`. You can't return nothing, `None` is the closest you get. – tdelaney Oct 04 '21 at 01:35