Here the goes,
list_of_list = [[]] * 10
list_of_list[0].append(1)
print(list_of_list)
There is a variable list_of_list which is a 10 element list containing empty list []. So initially the list is [[],[],[],[],[],[],[],[],[],[]]. So in the next line I have appended 1 to the first element of the variable list_of_list. So my expected result should be, [[1],[],[],[],[],[],[],[],[],[]]. But what I get is, [[1],[1],[1],[1],[1],[1],[1],[1],[1],[1]].
So why is this happening? How can I get my achieved result?
