2-dimensional data structures
Tim Chase
python.list at tim.thechases.com
Thu Jan 26 16:29:14 EST 2006
> I want to work on a sudoku brute-forcer, just for fun.
Well, as everybody seems to be doing these (self included...),
the sudoku solver may become the "hello world" of the new world :)
> What is the equivalent way to store data in python? - It isn't obvious
> to me how to do it with lists.
Several other answers have crossed the list. I've done it using
a dictionary of tuples:
grid = {}
for row in range(1,10):
for col in range(1,10):
grid[(row,col)] = value
item = grid[(3,2)]
etc.
Seemed fairly quick and worked for me.
-tkc
More information about the Python-list
mailing list