for _ in range(2):
a = [[1, 1, 1], [1, 1, 1], [0, 1, 1], [0, 0, 1]]
b = [randint(0,1) for i in range(3)]
c = [randint(0,1) for j in range(7)]
a.append(b)
a.insert(0,b)
count = 0
for i in a:
i.insert(0,c[count])
count += 1
the output is:
a = [
[1, 0, 1, 1, 1],
[0, 1, 1, 1],
[1, 1, 1, 1],
[1, 0, 1, 1],
[1, 0, 0, 1],
[1, 0, 1, 1, 1]
]
a = [
[1, 0, 1, 1, 1],
[0, 1, 1, 1],
[1, 1, 1, 1],
[1, 0, 1, 1],
[1, 0, 0, 1],
[1, 0, 1, 1, 1]
]
but I want first append and insert 2 list from b in list (a) then insert elements from c for each list in (a):
a = [
[1, 0, 1, 1, 1],
[0, 1, 1, 1, 1],
[1, 1, 1, 1, 0],
[1, 0, 1, 1, 1],
[1, 0, 0, 1, 0],
[1, 0, 1, 1, 1]
]
a = [
[1, 0, 1, 1, 1],
[0, 1, 1, 1, 1],
[1, 1, 1, 1, 0],
[1, 0, 1, 1, 1],
[1, 0, 0, 1, 0],
[1, 0, 1, 1, 1]
]