In the first example, consider what Python does for this statement:
b = 3 * [a]
This will:
b = [[a], [a], [a]]
Thus, the change awill be reflected in b, because it bconsists of objects a.
However, in the second example, you do the following:
b = 3 * a
Creates a copy of the list aand is equivalent to:
b = [1, 1, 1]
Thus, when adding to athis time, nothing has changed.
source
share