2
def numRookCaptures(self, board: List[List[str]]) -> int:3
# Checking for possible case to the right of Rook4
def right_position(n, i):5
List = i[0:n][::-1] # taking list to the right of rook6
pIndex, bIndex = -1, -17
if "p" in List: # Checking if 'p' in list8
pIndex = List.index("p")9
if "B" in List: # Checking if 'B' in list10
bIndex = List.index("B")11
print(bIndex, pIndex, List)12
if bIndex == -1 and pIndex > -1: # if list does not have 'B' and have 'p'14
if pIndex == -1: # if list does not have 'p'16
return bIndex > pIndex18
def left_position(n, i):19
List = i[n + 1 :] # taking list to the right of rook20
pIndex, bIndex = -1, -122
pIndex = List.index("p")24
bIndex = List.index("B")25
print(bIndex, pIndex, List)26
if bIndex == -1 and pIndex > -1:30
return bIndex > pIndex33
# Checking for possibilites in row38
if left_position(n, i):40
if right_position(n, i):43
# checking for possibilites in col44
for i in range(0, len(board)):45
Col.append(board[i][n]) # taking the elements from the same col of Rook47
if left_position(n, Col):49
if right_position(n, Col):