Welcome All
I try to make list using python named mylist with 3 element each element contain other list contain 2 element like these
[[None,None]]*3
When try to edit first nested list items in my list by set mylist[0][0] = 1
and mylist[0][1] = 2
Then try to print mylist This is output : [[1, 2], [1, 2], [1, 2]]
It edit all list items.
However when create it manually like mylist = [[None, None], [None, None], [None, None]]
then try to make my edit edition done correctly.
First Case Code :
mylist = [[None,None]]*3
mylist[0][0] = 1
mylist[0][1] = 2
print(mylist)
First Case Output:
[[1, 2], [1, 2], [1, 2]]
Second Case Code :
mylist = [[None, None], [None, None], [None, None]]
mylist[0][0] = 1
mylist[0][1] = 2
print(mylist)
Second Case Output:
[[1, 2], [None, None], [None, None]]