"Tairic" <ala...@gmail.com> wrote in message news:95ea7bdf-2ae8-4e5e-a613-37169bb36...@w35g2000prg.googlegroups.com...
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?

This will generate a list of nine unique, empty sets, box[0] through box[8]:

   box = [set() for i in range(9)]

-Mark





--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to