if n % 2:
    shell_sums.append(a[no2, no2])
return shell_sums
a = np.array([[8, 0, 7, 4, 3, 0, 0, 7, 6, 9], [8, 1, 0, 6, 3, 4, 2, 1, 4, 6
    ], [8, 5, 9, 6, 8, 0, 0, 1, 3, 0], [3, 2, 8, 9, 5, 8, 6, 5, 6, 7], [6, 
    7, 5, 1, 1, 0, 5, 1, 9, 0], [8, 9, 4, 5, 9, 7, 0, 0, 0, 4], [7, 9, 6, 7,
    4, 7, 5, 1, 7, 4], [6, 8, 2, 6, 1, 9, 8, 5, 2, 1], [9, 1, 1, 3, 7, 6, 8,
    0, 8, 7], [2, 8, 6, 3, 6, 5, 0, 3, 1, 8]])
b = np.array([[9, 5, 8, 6, 5], [1, 1, 0, 5, 1], [5, 9, 7, 0, 0], [7, 4, 7, 
    5, 1], [9, 5, 0, 2, 3]])
print(sum_shells(a))
print(sum_shells(b))
Как найти сумму числового слоя в ndarray