[Solved] Wondering how id() function works!? | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
+ 6

[Solved] Wondering how id() function works!?

Why on earth this code returns "True" and these objects have the same id? print(id([['1'],['2']])) print(id(['abc','def'])) print(id([['1'],['2']]) == id(['abc','def']))

21st Mar 2022, 6:05 PM
Siavash Kardar Tehran
Siavash Kardar Tehran - avatar
1 Antwort
+ 9
Ids play with objects not with expressions. https://code.sololearn.com/cjsc0lBa578b/?ref=app
21st Mar 2022, 6:23 PM
Oma Falk
Oma Falk - avatar