Conway's Game of Life
Write step(grid) that returns the next generation of a Game of Life grid (a of of 0/1). A live cell with two or three live neighbours survives; a dead cell with exactly three comes alive; everything else dies. Cells outside the grid count as dead.
Examples
A blinker [[0,1,0],[0,1,0],[0,1,0]] becomes [[0,0,0],[1,1,1],[0,0,0]]
Exercise
4 checksConway's Game of Life
def step(grid):
...
for row in step([[0, 1, 0], [0, 1, 0], [0, 1, 0]]):
print("".join("█" if c else "·" for c in row))
Press Run to try your code, then Check answer to grade it.