i am trying to display a 2D sudoku board in python like this:
0 0 3 |0 2 0 |6 0 0
9 0 0 |3 0 5 |0 0 1
0 0 1 |8 0 6 |4 0 0
------+------+------
0 0 8 |1 0 2 |9 0 0
7 0 0 |0 0 0 |0 0 8
0 0 6 |7 0 8 |2 0 0
------+------+------
0 0 2 |6 0 9 |5 0 0
8 0 0 |2 0 3 |0 0 9
0 0 5 |0 1 0 |3 0 0
I managed to display the board without the seperation lines using this code:
rows = 'ABCDEFGHI'
cols = '123456789'
def display(values):
for r in rows :
for c in cols :
print values[r+c],
print
values is a dictionary {'A1':'0', 'A2':'0', 'A3':'3', 'A4':'0', 'A5':'2'...etc} I get this output:
0 0 3 0 2 0 6 0 0
9 0 0 3 0 5 0 0 1
0 0 1 8 0 6 4 0 0
0 0 8 1 0 2 9 0 0
7 0 0 0 0 0 0 0 8
0 0 6 7 0 8 2 0 0
0 0 2 6 0 9 5 0 0
8 0 0 2 0 3 0 0 9
0 0 5 0 1 0 3 0 0
Any help?