I am creating a list in a for loop in python but I have no idea how to separate results of each itertaion. For example I want to keep the even numbers from 0 to 10 two times and I want to separate the results. I tried the following code:
res=[]
for i in range (2):
for j in range (10):
if j%2==0:
res.append(j)
But res is
[0, 2, 4, 6, 8, 0, 2, 4, 6, 8]
And I want to have it as:
[[0, 2, 4, 6, 8], [0, 2, 4, 6, 8]]
The point is that in reality results of my iteration have not the same length and I can not simply split my res based on the number of iteration. I do appreciate if anyone help me to do it.
ibefore the inner loop