As suggested in your comment, the task can be done directly without having to modify values to ints.

Input: A tuple `A` of `n` rows and `m` columns.  
Output: Whether there is matching $4$ "O"'s or 4 "X"'s on a diagonal, horizontal, or vertical line.  
Procedure:
```
# horizontal lines
For i in range(n):
    For j in range(m-3):
        Find if A[i][j], A[i][j+1], A[i][j+2], A[i][j+3] are 4 "0"s or 4 "X"s. Return accordingly if yes.
# vertical lines
For j in range(m):
    For i in range(n-3):
        Find if A[i][j], A[i+1][j], A[i+2][j], A[i+3][j] are 4 "0"s or 4 "X"s. Return accordingly if yes.
# diagonal lines
For i in range(n-3):
    For j in range(m-3):
        Find if A[i][j], A[i+1][j+1], A[i+2][j+2], A[i+3][j+3] are 4 "0"s or 4 "X"s. Return accordingly if yes.
# other diagonal lines
For i in range(3, n):
    For j in range(m-3):
        Find if A[i][j], A[i-1][j+1], A[i-2][j+2], A[i-3][j+3] are 4 "0"s or 4 "X"s. Return accordingly if yes.
Return False, since $4$ "O"'s or 4 "X"'s has been found.
```

There is not a lot of wisdom here. Just make sure of the ranges of the indices of the staring "O" or "X". 

The basic technique is, for example, if `A[i-3][j+3]` will be used, then it means "0 <= i-3 < n" and "0 <= j+3 < m", which means "3 <= i < n+3" and "-3 <= j < m -3". Together with "0 <= i < n" and "0 <= j < m", we have "3 <= i < n" and "0 <= j < m-3". That is why you see "i in range(3, n)" and "j in range(m-3)" in the case of "other diagonal lines".