• + 0 comments

    you can avoid writing the long sequence of additions the following way:

    1) create a variable called total equal to arr[i+1][j+1]
    2) create a third loop of k in range(3). 3) On each iteration of k, add arr[i][j+k] and arr[i+2][j+k] to total. 4) append total to k