[Tutor] Creating Sudoku

Luke Paireepinart rabidpoobear at gmail.com
Mon Apr 7 07:31:30 CEST 2008


Tom Haynes wrote:
>
> G’day,
>
>  
>
> I am trying to create a simple Sudoku game that takes a simple 
> raw_input of a, r, c or something similar (where a = row, r = column, 
> c = number to place there) and place it in a Sudoku game square. I 
> have tried many times to start it from different angles and just can’t 
> do it. If someone could help step me through what needs to be done 
> that would be greatly appreciated!
>
Sounds like you need to have a 2-dimensional list to store your values.  
The first and second indexes of the list would correspond to the 
row/column variables you have, and the value would be the actual value 
at each location.  You may want to initialize your list to some value 
(fill it with something).  You could also use a dictionary, but it would 
probably not be worthwhile.
You would also probably want to use the int(some_value) conversion on 
your raw_inputs so you can use the values to index your list.
Let us know if this is not enough of a hint!  Hope it goes okay.
-Luke


More information about the Tutor mailing list