When I try to modify a value in a list, it is also modifying a separate value in another list. I don't believe this would be a bug, but I would like to know how to treat these variables independently.
I have tried this for single variables instead of lists, and this problem does not occur. I could set the lists separately, but that seems unnecessary for when there are a large number of lists.
numbers = [1,2,3,4,5]
list_A = numbers
list_B = numbers
print("list A:",list_A)
print("list B:",list_B)
list_A[2] = 10
print("list A:",list_A)
print("list B:",list_B)
I would expect an output of:
list_A:[1, 2, 3, 4, 5]
list_B:[1, 2, 3, 4, 5]
list_A: [1, 2, 10, 4, 5]
list_B: [1, 2, 3, 4, 5]
but instead get this:
list_A:[1, 2, 3, 4, 5]
list_B: [1, 2, 3, 4, 5]
list_A: [1, 2, 10, 4, 5]
list_B: [1, 2, 10, 4, 5]
where both lists have been modified