As a beginner to Python(SAGE) I want to put the output of this for loop into a list:
for y in [0,8] :
for z in [0,1,2,3] :
x=y+z
print x
The output is
0
1
2
3
8
9
10
11
(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:
x=[]
for y in [0,2*3] :
for z in [0,1,2,3] :
x=y+z
x.append(x)
print x