The problem of python Recursion and the question of list remove

problem description

Why does the operation on code_3 affect the value of code_2?
originally there is no relationship between the two.

the environmental background of the problems and what methods you have tried

I personally understand that I assign values in the first few lines of code and operate in the for loop without affecting the value of code--2, but my debug found that the value of code_2 has also changed. no, no, no.
I don"t know why this happens. Isn"t Python translated line by line? no, no, no.

related codes

/ / Please paste the code text below (do not replace the code with pictures)

code=[1,2,3,4,5]
code_1=code
-sharp 
for i in code:  -sharp code   "A"
    print(i)
    for k in code_1:
        print(k)
    code_1.remove(i)
    

what result do you expect? What is the error message actually seen?

what I expect is that code and code_1 do not affect each other, but I have deleted the code1 element, why the code element will also be deleted.

Aug.01,2021

if you don't want to be changed, you need to copy, not assign
such as

code_2=code.copy()
After

assignment, the reference to the object is a

>>> code=[1,2,3,4]
>>> id(code)
4552379656
>>> code2=code
>>> id(code2)
4552379656

you can see that their ID is equal, pointing to the same address (object) in memory. Changing one naturally affects another
copy or rebuilding one with list or [:] methods, id is different, and changing one naturally does not affect the other.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1eb0771-22da.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1eb0771-22da.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?