I am a beginner to programming and was working in a for loop and realised the error I was getting is because of the reason in the title. Why Does the happen anyway? Is this a general property of mutable ojects?.
T
I am a beginner to programming and was working in a for loop and realised the error I was getting is because of the reason in the title. Why Does the happen anyway? Is this a general property of mutable ojects?.
T
append
modifies the list in place. There is no need to do L=L.append(x)
; Simply running L.append(x)
should suffice. The reason L is being set to none in your code is because there is no return value for append