iterate to make multiple variables?

john gnujohn at gmail.com
Tue Apr 21 08:00:15 CEST 2009


On Apr 19, 11:11 pm, Tairic <ala... at gmail.com> wrote:
> Hi, I'm somewhat new to programming and especially to python. Today I
> was attempting to make a sudoku-solver, and I wanted to put numbers
> into sets call box1, box2, ... box9, so that I could check new values
> against the boxes
>
> I ended up declaring the boxes like this
> box1 = set([])
> box2 = set([])
> ..
> ..
> box9 = set([])
>
> Is there a way for me instead to generate these variables (box1 to
> box9) as empty sets instead of just writing them all out? Some way to
> iterate and generate them?
>
> Sorry if this is confusing, thanks in advance.




More information about the Python-list mailing list