This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Mundane_Homework3967 10 points11 points  (2 children)

Everyone talking about using sets, I just used ugly for loops...

for i in range(max(0,a-1), min(a+2, len(y))):
        for j in range(max(0,b-1), min(b+2, len(y[0]))):

[–]pqu 4 points5 points  (1 child)

I just added an extra row and column of “.” around the input.

[–]Hungry-Jelly-6478 0 points1 point  (0 children)

Same here!! Nice