Function runs perfectly, but I am getting error with mypy:
Unsupported target for indexed assignment
Here is my code:
def function(image: List[str], start: Tuple[int]):
if image[start[0]][start[1]] == "*":
return
else:
image[start[0]][start[1]] = "*"
if start[0] > 0:
function(image, [start[0]-1, start[1]])
if start[0] < len(image) - 1:
function(image, [start[0]+1, start[1]])
if start[1] > 0:
function(image, [start[0], start[1]-1])
if start[1] < len(image) - 1:
function(image, [start[0], start[1]+1])
The mistake is in line:
image[start[0]][start[1]] = "*"
image = ["*", "."] start = (1, 1) - tuple contains coordinates.