Added matrix for part1 and neighbor function
This commit is contained in:
parent
b7b359d3f8
commit
08ab7201ab
@ -25,5 +25,20 @@ neighbors = lambda x, y : [(x2, y2) for x2 in range(x-1, x+2)
|
||||
(x != x2 or y != y2) and
|
||||
(0 <= x2 <= X) and
|
||||
(0 <= y2 <= Y))]
|
||||
pprint(neighbors(4,2))
|
||||
|
||||
for idx,i in enumerate(arr):
|
||||
for jdx,j in enumerate(i):
|
||||
tmp = arr[idx][jdx]
|
||||
if tmp.isdigit() == False and tmp != '.':
|
||||
print(tmp)
|
||||
print(idx,jdx)
|
||||
|
||||
n = neighbors(4,2)
|
||||
|
||||
pprint(n)
|
||||
|
||||
for i in n:
|
||||
print(i)
|
||||
print(arr[i[0]][i[1]])
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user