My code gets failed at 3 cases please help me in rectifying it

Here is my code, please check it and help me rectify it. I did everything right as I feel still can’t understand where I am committing a mistake.

at line no 6
start counter with 0 not with 1

after that your code will pass all testcases and give correct output
i have tested your code after correction

kindly give feedback from below link

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.