Hi, I would like to append lists into one list in a for loop. See my code bellow:
def triangle(n: int): pole = [] seznam = [] i = 0 j = 0 while j < n : while i <= j: a = pole.append(1) print(pole) seznam.append(a) i +=1 j +=1 print(seznam) ####ENDMy output for
triangle(4)
isOutput:[1]
[1, 1]
[1, 1, 1]
[1, 1, 1, 1]
[None, None, None, None]
But desired output for triangle(4)
is:Output:[[1], [1, 1], [1, 1, 1], [1, 1, 1, 1]]
Can you help me, how can I replace "None" with lists of 1? Thank you very much!