Last updated 2 years ago
row = 0 col = 0 directions = [(0, 1), (1, 0), (0, -1), (-1, 0)] for drow, dcol in directions: if 0 <= row + drow < rows and 0 <= col + dcol < cols: # Do Something