2-dimensional data structures

Carl Cerecke cdc at maxnet.co.nz
Thu Jan 26 16:18:21 EST 2006


anthonyberet wrote:
> Hello again - rather a newbie here...
> 
> I want to work on a sudoku brute-forcer, just for fun.

I know what you mean. I wrote one just for fun too.

> I am considering different strategies, but first I need to decide on the 
> data-structure to use for the progress/solution grid.
> 
> This being a square, I would have used a 9x9 2-dimensional array in my 
> teenage years back in the 80's, using BASIC.
> 
> What is the equivalent way to store data in python? - It isn't obvious 
> to me how to do it with lists.

List of lists.
One list with nine elements, each of which is a list with nine numbers.
[[5,2,7,3,9,8,1,4,6],
  [3,1,4,....],
  ....
]

Cheers,
Carl.



More information about the Python-list mailing list