Loop over time and over list elements with python -- one-dimensional lake temperature model simulation
<p>I want to build a one-dimensional model simulation of water temperature in a lake.
The lake is divided into layers, each layer temperature value is stored as an element of a list. The simulation is performed over time. I have to change each element of the list, or certain sequences of the list using functions and algorithms in each time step. 
I can´t find the best way to do the main loop :
Loop over time and over list elements and be able to use the value of a particular element of the list obtained in the previous time step.</p>

<p>This is just an example:</p>

<pre><code>Time step 0: list”0”=[10,10,10]

Time step 1: list”1”=[  list”0”[0]+def change(n) ,  list”0”[1]+ 1   , list”0”[2]+3  ]

Time step 2: list”2” ”=[  list”1”[0]+ def change(t),  list”1”[1]+ 2   , list”1”[2]+2  ]

Time step 3: list”3=[  list”2”[0]+ def change(r),  list”2”[1]+ 1   , list”2”[2]+4  ]
</code></pre>

<p>Initially I thought in a list of lists:<br>
Each list element corresponds to a time step, this way I can access the previous time step and use the previous value (Is this a good approach?):</p>

<pre><code>Time step 0 Time step 1 Time step 2 Time step 3 
List=[[10,10,10],[ 12,13,14],[ 12,14,12],[ 11,13,11]] 
</code></pre>

<p>Where can I read something to help me or some script examples? Thank you.</p>
