+ 1
Why is this code wrong? Help)
def search (text, word): if text.find(word) == -1: print("Word not found") else: print("Word found") return text = input() word = input() print(search(text, word))
1 Réponse
+ 5
Khs SmL ,
the last line should be modified. don't use print here, it outputs 'None' additional to the output that is already done in the function.
...
search(text, word)
-> also remove 'return' at the end of the function
-> use proper indentation which is 4 spaces per indentation level