Pls help me to debug the code

I have made changes in the code due to which all except 1 test case is getting passed.Pls help me debug this code

@Senjuti256
refer to this corrected code

pls can you point out the error in my code so that I don’t repeat the mistake in future. With the same code and a bit different logic I solved the similar prblm dictionary bigger