Jul-04-2021, 12:34 PM
Hi Yoriz,
thanks for the reply. Oke, I see. So in your first example (which corresponds to my case), the values are changed in multiple places because the lists are the same, right?
Now if I consider the following example:
thanks for the reply. Oke, I see. So in your first example (which corresponds to my case), the values are changed in multiple places because the lists are the same, right?
Now if I consider the following example:
# define variable a = 0 # create 1D list lst = [0]*10 for i in range(10): lst[i] = a # print the list print(lst) # assign value to element of list lst[1] = 4 # print list after element assignment print(lst)I would expect that changing lst[1] results in a change of all entries in that list, because in this case lst[0] == lst[1] == lst[2] etc.. Why does it not update the entire list in this case?