#create list
listA = [1,2]
#'duplicate' list
listB = listA
#remove item in 'duplicate'
listB.remove(1)
#item has been removed from listA even though it hasn't been edited
print(listA)
# Result: [2]
Logically I would assume that listA would not get edited. Since I'm not directly editing it. So if python points to locations of variable 'contents' then I can understand it. Since listB would not be a true 'duplicate' but another 'sign post' pointing to the same set of information. But if thats true, then why:
#
create variable
intA = 5
#'duplicate' variable
intB = intA
#chane item in 'duplicate'
intB = 0
#item has NOT been removed from listA because it hasn't been edited
print(
intA )