+ 1

Explain this code

why 1st is true and 2nd is false in code below. plz explain in detail https://code.sololearn.com/c13R23AaxtHM/?ref=app

10th Dec 2017, 8:23 AM
Gamer
Gamer - avatar
3 Answers
+ 3
Suppose we have arr = [1,2,3]. Then b = arr just gives an alias for the same object. You can verify this as James did by using the id() operator. To copy-construct a new object b, you can do b = arr[:] or b = list(arr).
10th Dec 2017, 10:06 AM
Eric Blinkidu
Eric Blinkidu - avatar
0
so now explain last line of this code https://code.sololearn.com/c7guBgouUZYW/?ref=app
10th Dec 2017, 2:03 PM
Gamer
Gamer - avatar