Count the islands

grid is a list of strings of equal length made of "1" (land) and "0" (water). An island is a group of land cells connected up, down, left or right (not diagonally). Write count_islands(grid) that returns how many islands there are.

count_islands([
    "11000",
    "11000",
    "00100",
    "00011",
])  ->  3
count_islands(["000"])  ->  0

The point is to practise treating a grid as a graph: neighbours are computed from coordinates and checked against the bounds.

def count_islands(grid):
    ...