How to put Python loop output in a list
<p>As a beginner to Python(SAGE) I want to put the output of this for loop 
into a list:</p>

<pre><code>for y in [0,8] : 
   for z in [0,1,2,3] :
     x=y+z

     print x
</code></pre>

<p>The output is </p>

<pre><code>0
1
2
3
8
9
10
11
</code></pre>

<p>(vertically). I want a list so I can use it for a later operation:
I want [1,2,3,8,9,10,11].
I found a similar question and I realize that the output is recalculated
each time. Is there a simple way to store them in a list? Following a suggestion for the other answer, I tried "append" like this, but it gives an error message:</p>

<pre><code>x=[]
for y in [0,2*3] : 
 for z in [0,1,2,3] :
   x=y+z
   x.append(x)

  print x
</code></pre>

<p>Try:</p>

<pre><code>x = [y+z for y in [0,8] for z in [0,1,2,3]]
</code></pre>

python