Memory address in python.. each time when we execute, id is changing.. can anyone explain the reason? | SoloLearn: Learn to code for FREE!

0

Memory address in python.. each time when we execute, id is changing.. can anyone explain the reason?

mylist=[1,2,3] x=mylist x=[2,4,5] x[1]=6 print(x) print(mylist) print(id(x)) print(id(mylist))

3/16/2017 8:45:22 AM

Abin Singh R

1 Answer

New Answer

0

you have two lists: [123] and [245]. mylist references to 123, while x references to 245