Here's my code:
res = [[]] * 4
res[0] = ['0', '1']
res[1].extend(['1' + x for x in res[0]])
After each line, res is equal to:
[[], [], [], []]
[['0', '1'], [], [], []]
[['0', '1'], ['10', '11'], ['10', '11'], ['10', '11']]
Why is res not equal to [['0', '1'], ['10', '11'], [], []]
after line 3? How could I extend res[1] without also extending res[2] and res[3]?