• Problems with the program not executing my code

 

It is giving me test 3/4 and 4/4 errors but its not executing my code on this tests(and it pass to the 4 without getting the 3 right). It stops evaluating at basic 4/4.

From: https://checkio.org/mission/count-neighbours/solve/

def count_neighbours(grid, row, col): suma = 0 dim = len(grid)

for i in range(3):
    for j in range(3):
        if (row+i)>dim or (col+j)>dim or(row-1+i)<0 or (col-1+j)<0:
            continue
        elif i==1 and j==1:
            continue
        else:
            suma = suma + grid[row-1+i][col-1+j]
        print ("ok i=%r j=%r suma=%r" % (i,j,suma))
return (suma)
4