I am trying to make a sudoku solver and I started with the input that divides it into columns like this:
column_full = []
column_num = 9
#Puts your input in colums
for column in range(column_num):
column_input = input()
column_list = column_input.split()
column_full.append(column_list)
This part works fine. For example when I input:
1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9
the program returns this like it should:
[['1', '2', '3', '4', '5', '6', '7', '8', '9'],
['1', '2', '3', '4', '5', '6', '7', '8', '9'],
['1', '2', '3', '4', '5', '6', '7', '8', '9'],
['1', '2', '3', '4', '5', '6', '7', '8', '9'],
['1', '2', '3', '4', '5', '6', '7', '8', '9'],
['1', '2', '3', '4', '5', '6', '7', '8', '9'],
['1', '2', '3', '4', '5', '6', '7', '8', '9'],
['1', '2', '3', '4', '5', '6', '7', '8', '9'],
['1', '2', '3', '4', '5', '6', '7', '8', '9']]
But the part which divides columns into rows is broken!
I divide coulmns into rows like this:
column_full = []
row_full = []
box_full = []
one_row = []
column_num = 9
#Puts your input in colums
for column in range(column_num):
column_input = input()
column_list = column_input.split()
column_full.append(column_list)
# ***Converts columns in rows***
for column_choice in range(column_num):
one_row.clear()
for first_index_row in range(column_num):
one_row.append(column_full[first_index_row][column_choice])
row_full.append(one_row)
But it doesn't return this list:
[['1', '1', '1', '1', '1', '1', '1', '1', '1'],
['2', '2', '2', '2', '2', '2', '2', '2', '2'],
['3', '3', '3', '3', '3', '3', '3', '3', '3'],
['4', '4', '4', '4', '4', '4', '4', '4', '4'],
['5', '5', '5', '5', '5', '5', '5', '5', '5'],
['6', '6', '6', '6', '6', '6', '6', '6', '6'],
['7', '7', '7', '7', '7', '7', '7', '7', '7'],
['8', '8', '8', '8', '8', '8', '8', '8', '8'],
['9', '9', '9', '9', '9', '9', '9', '9', '9']]
It returns this list:
[['9', '9', '9', '9', '9', '9', '9', '9', '9'],
['9', '9', '9', '9', '9', '9', '9', '9', '9'],
['9', '9', '9', '9', '9', '9', '9', '9', '9'],
['9', '9', '9', '9', '9', '9', '9', '9', '9'],
['9', '9', '9', '9', '9', '9', '9', '9', '9'],
['9', '9', '9', '9', '9', '9', '9', '9', '9'],
['9', '9', '9', '9', '9', '9', '9', '9', '9'],
['9', '9', '9', '9', '9', '9', '9', '9', '9'],
['9', '9', '9', '9', '9', '9', '9', '9', '9']]
I don't know if I'm just being dumb or is there I am missing? Thanks for all the help!