Please give me the reason for this error
text = "Amy has 128 dollars, while David has 54 dollars. Amy is going to the zoo. David watches soccer." Split_text=text.split(" ") O_text=input() R_text=input() count=0 for i in range(len(Split_text)): e_list=Split_text[i] if "," in Split_text[i] and (e_list[:-1]==O_text): Split_text[i]=R_text+"," count=count+1 if ("." in Split_text[i]) and (e_list[:-1]==O_text) : Split_text[i]=R_text+"." count=count+1 if(Split_text [i]==O_text): Split_text [i]=R_text count=count+1 print(count) for i in range(len(Split_text)): if(i==len(Split_text)-1): print(Split_text[i]) else: print(Split_text[i],end=" ") In the above program(manipulating the substring with another) 4 test cases are correct but one test is an error.. Due to hide of that case I can't solve it. so please give the solution for it.