Sep-18-2019, 07:00 PM
Please read https://python-forum.io/misc.php?action=help&hid=25 how to use code tags to format your question.
The error is because the first time your list a[] will have 1 item. So a[n-2] will yield a negative index. This is the error you get.
The error is because the first time your list a[] will have 1 item. So a[n-2] will yield a negative index. This is the error you get.