why doesnt it work?
board = [ [7,8,0,4,0,0,1,2,0], [6,0,0,0,7,5,0,0,9], [0,0,0,6,0,1,0,7,8], [0,0,7,0,4,0,2,6,0], [0,0,1,0,5,0,9,3,0], [9,0,4,0,6,0,0,0,5], [0,7,0,3,0,0,0,1,2], [1,2,0,0,0,7,4,0,0], [0,4,9,2,0,6,0,0,7] ] def solve(bo): for column in bo: for n, i in enumerate(column): if i == 0: #Find the box that the epty space is in pos_x = (column.index(i) // 3) * 3 pos_y = (bo.index(column) // 3) * 3 #insert numbers inside empty space for k in range(1, 10): if validation(k, column, bo, pos_x, pos_y) == True: column[n] = k return print_board(bo) def validation(num, col, game_board, box_x, box_y): if num in col: return False else: box_nums = [] for x in range(0, 3): box_nums.append(game_board[box_y][box_x * 3:(box_x * 3) + 3]) box_y += 1 if num in box_nums[0] or box_nums[1] or box_nums[2]: box_nums.clear() return False return True def print_board(the_board): for k in the_board: print(k) print(solve(board)) ---------------------------------- line 22 never works ps:the code is still not finished