Below is non-working and working code which generates a list of lists.
Example 1 does not work correctly, it repeats the last list appended over and over.
Example 2, where I replaced delete with creating a new list does work correctly.
# Example 1, this does not work correctly
l1 = []
l2 = []
x = 0
for n in range(0,3):
del l1[:] # deleting all list elements
for i in range(0,3):
l1.append(x)
x+=1
l2.append(l1)
print(l2)
# Example 2, this works correctly
l2 = []
x = 0
for n in range(0,3):
l1 = [] # creating the list each loop through
for i in range(0,3):
l1.append(x)
x+=1
l2.append(l1)
print(l2)