the code should show possible numbers for a row nd column like
get_possible_numbers(board,3,3)
should show
[‘1’, ‘2’, ‘3’, ‘6’, ‘8’, ‘9’]
board = [[‘4’, ‘.’, ‘7’, ‘.’, ‘.’, ‘8’, ‘9’, ‘6’, ‘2’],
[‘.’, ‘.’, ‘1’, ‘.’, ‘2’, ‘.’, ‘.’, ‘.’, ‘.’],
[‘5’, ‘.’, ‘.’, ‘7’, ‘.’, ‘.’, ‘.’, ‘.’, ‘.’],
[‘7’, ‘5’, ‘.’, ‘.’, ‘.’, ‘.’, ‘.’, ‘.’, ‘4’],
[‘.’, ‘.’, ‘.’, ‘.’, ‘4’, ‘.’, ‘.’, ‘.’, ‘.’],
[‘6’, ‘.’, ‘.’, ‘.’, ‘.’, ‘.’, ‘.’, ‘9’, ‘8’],
[‘.’, ‘.’, ‘.’, ‘.’, ‘.’, ‘1’, ‘.’, ‘.’, ‘6’],
[‘.’, ‘.’, ‘.’, ‘.’, ‘5’, ‘.’, ‘8’, ‘.’, ‘.’],
[‘1’, ‘2’, ‘9’, ‘4’, ‘.’, ‘.’, ‘3’, ‘.’, ‘5’]
]
def get_possible_numbers(board,row,col):
possible_numbers = range(1, 10)
if board[row][col] != “.”:
return [board[row][col]]
else:
for i in xrange(9):
if board[row][i]!=“.”:
if int(board[row][i]) in possible_numbers:
possible_numbers.remove(int(board[row][i]))
if board[i][col]!=“.”:
if int(board[i][col]) in possible_numbers:
possible_numbers.remove(int(board[i][col]))
return possible_numbers
this the code i tried out put it doesnt give possible numbers when i type
get_possible_numbers(board,3,3)
it shows some error
please help me out…