+ 1

Why it is false???

a=[] b=[] print(a is b )

29th Apr 2018, 11:03 PM
Omar
Omar - avatar
5 Answers
29th Apr 2018, 11:07 PM
cyk
cyk - avatar
+ 5
is asks if they reference the same object
29th Apr 2018, 11:22 PM
ChaoticDawg
ChaoticDawg - avatar
+ 3
a=[] b=a print(b is a) #True because their b depend on a and we can say b is child and a is parents of b,so they has same D.N.A,so b is a True. a=[] b=[] print(a is b) #False because their b does not depend on a and we can say b is parents and a is also another parents,so they has not same D.N.A, so b is a False.
30th Apr 2018, 1:18 AM
Maninder $ingh
Maninder $ingh - avatar
+ 2
Omar o you need to watch this video. https://youtu.be/CZ8bZPqtwU0
30th Apr 2018, 10:12 AM
Maninder $ingh
Maninder $ingh - avatar
0
Maninder Singh but when i say a=1 c=1 a is c true although a isnot parents of c??
30th Apr 2018, 8:42 AM
Omar
Omar - avatar