names in python are just pointers, at the beginning name a points to an int object - 20 with id 4428144000
after you call the function name a points to different int object - 12 (i.e. different location in memory, thus different id 4428144032)
as you can see c is pointing to same object, although element at index 0 has changed (which is possible, because lists are mutable objects).
Read this https://nedbatchelder.com/text/names1.html
also
after you call the function name a points to different int object - 12 (i.e. different location in memory, thus different id 4428144032)
as you can see c is pointing to same object, although element at index 0 has changed (which is possible, because lists are mutable objects).
Read this https://nedbatchelder.com/text/names1.html
also
a = 5 b = 5 print(id(a), id(b))
Output:11381600 11381600
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs