+ 1
Print ("p" is "p", [] is [])
what is the output and why?!
4 Answers
+ 3
Well if you write p=[] and then s=[], it will be two different empty lists because they use different parts of RAM while executing code. That's why two empty lists in the left and right from 'is' are different empty lists.
+ 6
Plus you have to define the 'p' variable, first :)
+ 3
Both outputs are False. 'Is' returns True only if two expressions are the same objects, but it's not enough for them to have the same values.
+ 1
i edit the question but when i try it [] is [] it gives a false while both are empty lista if I'm not wrong