Python list multiplication: [[…]]*3 makes 3 lists which mirror each other when modified
Why this is happening? I don’t really understand: >>> P = [ [()]*3 ]*3 >>> P [[(), (), ()], [(), (), ()], [(), (), ()]] >>> P[0][0]=1 >>> P [[1, (), ()], [1, (), ()], [1, (), ()]] Answers: Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may … Read more