for in range for in range print def count_func arr arr if n-1 total co

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
n = 4
a = [[2 for x in range(n)] for x in range(n)]
print(a)
def count_func(arr, i, j):
arr[i][j] = 5
if j < n-1:
total = count_func(arr, i, j + 1)
else:
if i < n-1:
total = count_func(i + 1, 0)
else:
total = 0
add_bool = True
for x in range(n):
if add_bool:
add_bool = (a[x][0] + a[x][1] + a[x][2] + a[x][3]) in set((11, 17))
for x in range(n):
if add_bool:
add_bool = (a[0][x] + a[1][x] + a[2][x] + a[3][x]) in set((11, 17))
if add_bool:
total += 1
return total