What I've tried to do here is-
Take 08 ,for example, which lies first on the grid. The position of 08 is 0 in the 0th list of the 'data' list. So the number along the diagonal would be the term 1 of the 1st list of the data list. Then the third number would be on the position 2 of the 2nd......... and so on. Right?

This seems to work fine for the numbers at the beginning, but at the end what the function has basically done is generate the row, which obviously would result in an error. Can someone guide me through this?? Thanks.

Thanks,finally got the right answer after I used the modification you suggested. However I'm still not fully sure I understand ho your code actually works. When try gives an error, except is executed, right? So, why is the else necessary??

If we have exception from one line only that should be in try. Those lines from which we are not catching exception after try did not cause exception, should go to else part of try statement. The else part of for which is executed only if break is not executed(analoguous to the try explained before only break instead of exception) I think I put comment there that I use the else for maximum because do not consider shorter than four sequence sums. In exceptional case the sum of two numbers coud be maximum but I understood rules so.