What to add to the code to make it work for the last index?

Ma’am’ s code is not working for the last index as the loop is only running once therefore what should we add to make it work.

Hey @yashhanda028_2ac57e80580f4767 Mam’s code is taking every case into account even the last index.

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.