+ 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))

30th May 2022, 4:55 PM
Khs SmL
1 Odpowiedź
+ 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
30th May 2022, 5:22 PM
Lothar
Lothar - avatar