# [Tutor] Lists in List question

Ewald Ertl ewald.ertl at hartter.com
Fri Jun 24 09:28:48 CEST 2005

```Hello Phil!

the HTML-Formating look's better than the text-Version.

on Thu, 23 Jun 2005 17:15:59 -0500  Phillip Hart <phillip.hart at gmail.com> wrote :
---------------------------------------------------------------------------------------------

Phillip Hart > Hello,
Phillip Hart > I've been using lists within lists for several functions, but have been
Phillip Hart > unable, in loop form, to extract data from them or, in loop for, apply data
Phillip Hart > to them.
Phillip Hart >
Phillip Hart > Basically, when extracting data, it only runs 1 loop. Likewise, when
Phillip Hart > initially assigning the data, it only runs 1 loop.
Phillip Hart >
Phillip Hart > In the following example, the loop works once for x, and then a full loop (8
Phillip Hart > times) for y:
Phillip Hart >
Phillip Hart > ###
Phillip Hart > rr1=[0,0,0,0,0,0,0,0]
Phillip Hart > rr2=[0,0,0,0,0,0,0,0]
Phillip Hart > rr3=[0,0,0,0,0,0,0,0]
Phillip Hart > rr4=[0,0,0,0,0,0,0,0]
Phillip Hart > rr5=[0,0,0,0,0,0,0,0]
Phillip Hart > rr6=[0,0,0,0,0,0,0,0]
Phillip Hart > rr7=[0,0,0,0,0,0,0,0]
Phillip Hart > rr8=[0,0,0,0,0,0,0,0]
Phillip Hart > results=[rr1,rr2,rr3,rr4,rr5,rr6,rr7,rr8]
Phillip Hart >
Phillip Hart >
Phillip Hart > x=0
Phillip Hart > y=0
Phillip Hart > while x<8:
Phillip Hart > while y<8:
Phillip Hart > value=x+y
Phillip Hart > results[x][y]=value
Phillip Hart > y=y+1
Phillip Hart > x=x+1
Phillip Hart >

In the nested while-Loop's there is no reset of y during each run for an incremented x
so after the first turn the second while will never be run, because y is allways set to 8.

------------------- end ----------------------

HTH Ewald

```