-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathlistb.py
52 lines (51 loc) · 1.66 KB
/
listb.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
def listb(a,i,j):
lst=[]
if((i-1)%3==0):
if((j-1)%3==0):
for k in range(i,i+3):
for l in range(j,j+3):
if a[k][l]!=0:
lst.append(a[k][l])
elif((j-2)%3==0):
for k in range(i,i+3):
for l in range(j-1,j+2):
if a[k][l]!=0:
lst.append(a[k][l])
else:
for k in range(i,i+3):
for l in range(j-2,j+1):
if a[k][l]!=0:
lst.append(a[k][l])
elif((i-2)%3==0):
if((j-1)%3==0):
for k in range(i-1,i+2):
for l in range(j,j+3):
if a[k][l]!=0:
lst.append(a[k][l])
elif((j-2)%3==0):
for k in range(i-1,i+2):
for l in range(j-1,j+2):
if a[k][l]!=0:
lst.append(a[k][l])
else:
for k in range(i-1,i+2):
for l in range(j-2,j+1):
if a[k][l]!=0:
lst.append(a[k][l])
else:
if((j-1)%3==0):
for k in range(i-2,i+1):
for l in range(j,j+3):
if a[k][l]!=0:
lst.append(a[k][l])
elif((j-2)%3==0):
for k in range(i-2,i+1):
for l in range(j-1,j+2):
if a[k][l]!=0:
lst.append(a[k][l])
else:
for k in range(i-2,i+1):
for l in range(j-2,j+1):
if a[k][l]!=0:
lst.append(a[k][l])
return lst