+ 1
Search Engine: Lesson 45, I try call function split_compare() but...., help please, thanks
text = input() word = input() def split_compare(a, b): w_a = b.split(" ") for i in w_a: if i != a: return False elif i == a: return True else: return "It's broken" def search(t, w): t_l = t.lower() w_l = w.lower() if split_compare(t_l, w_l): # calling function not working? return "Word found" else: return "Word not found" print(search(text, word)) # result always "Word not found"
3 Réponses
+ 3
Change if i != a to if i not in a
0
I want to try child helper function to explore python format code
0
it's worked as expected thanks really