When I tried the following codes in Python, I realized changing one list will change the other list too. Could anyone explain why? I am writing a for loop using list.remove, so I need to keep the original list unchanged. Thanks!
list1=list(range(1,11))
list2=list1
list1.remove(1)
print(list2)
# the result is [2,3,4,5,6,7,8,9,10]
list1=list(range(1,11))
list2=list1
list2.remove(1)
print(list1)
# the result is [2,3,4,5,6,7,8,9,10]