Please check why such a wrong output is showing

I have written everything as was taught in the class. Then why is this wrong output showing? Please check.

@saijaltripathy_e79096f8f1ec20e3 A silly mistake has been done . SEE carefully that your
nsp = nsp -1 condition is mistakenly written outside the main while loop i.e. your while loop with row <= n: put this condition inside the while and your code will work fine because here your nsp is not getting updated.

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.