[Tutor] tables and dictionaries
Sheila King
sheila@thinkspot.net
Fri, 04 May 2001 23:05:51 -0700
On Fri, 04 May 2001 22:48:35 -0700, Sheila King <sheila@thinkspot.net> wrote
about Re: [Tutor] tables and dictionaries:
:
:I suggest a nested loop structure, like this...
:
:for firstElt in list:
: for secondElt in list:
: table[ (firstElt, secondElt) ] = None
Here's a thought:
To help you better see what is going on in a nested looping structure like the
one above (where one loop is inside another), try this piece of code, and see
what it does:
>>> for firstNum in range(2,5):
... for secondNum in range(11,16):
... print firstNum, ' + ', secondNum, ' = ', firstNum + secondNum
... print "inside loop ended"
...
--
Sheila King
http://www.thinkspot.net/sheila/
http://www.k12groups.org/