By definition List.append(elem)
adds a single element to the end of the list.
however, the result of the codes below does not follow the rule:
lista = []
listb = []
for i in "abc":
lista.append(i)
listb.append(lista)
print(listb)
The result is:
[['a', 'b', 'c'], ['a', 'b', 'c'], ['a', 'b', 'c']]
according the rule, the result should be
[['a'], ['a', 'b'], ['a', 'b', 'c']]
why is that? and how to get the second result?