0
I want to group two indices that are received from positions that are results of if’s/Elif’s
def MakeListOfFreeFields(board):
n_rows = len(board)
n_cols = len(board[0])
tfields = ()
for row in range(n_rows):
for column in range(n_cols):
if board[row][column] == '1':
tfields += ([row],[column])
elif board[row][column] == '2':
tfields += ([row],[column])
elif board[row][column] == '3':
tfields += ([row],[column])
elif board[row][column] == '4':
tfields += ([row],[column])
elif board[row][column] == '5':
tfields += ([row],[column])
elif board[row][column] == '6':
tfields += ([row],[column])
elif board[row][column] == '7':
tfields += ([row],[column])
elif board[row][column] == '8':
tfields += ([row],[column])
elif board[row][column] == '9':
tfields += ([row],[column])
print(tfields)
O resultado desse print é:
([0], [0], [0], [1], [0], [2], [1], [0], [1], [1], [1], [2], [2], [0], [2], [1], [2], [2])
E eu gostaria que fosse:
([0][0], [0][1], [0][2], [1][0], [1][1], [1][2], [2][0], [2][1], [2][2])