0

I was solving a problem using python2 and I used 'seq= [[]]*2' because I wanted this '[[],[]]. But I got wrong answer. Then I tested it in IDLE like this:

>>>s=[[],[]]
>>>seq=[[]]*2
>>>seq
[[], []]
>>>s[0].append(5)
>>>s
[[5],[]]
>>>seq[0].append(5)
>>>seq
[[5],[5]]

I am totally confused. Can anyone help me? Please.

0 Answers0