0
List assignment in python
num1=[1,2,3,4] num2=num1 print(num1) num2[0]=5 print(num1[0]) Above code last line output 5, why?
1 Answer
+ 9
Array is by default reference type.
If you assign a array to another variable. That variable has the same reference to that array. if you change value of one array others will also change.