a = [[],[],[],]
a[1].append(5)
print(a)
Above Code will print the output as [[ ], [5], [ ]]
a = [[]]*3
a[1].append(5)
print(a)
Above Code will print the output like [[5], [5], [5]]
Could anyone please explain to me why there are '5' in all the lists as I have appended it only first list.