+ 2
I put 2 variables with the value 267 and compared it with the " is" command in Python and returns the False value. What is the
With a few other values that were above 267, it had the same result. Why? Their id is also different
3 Réponses
+ 2
Check this ,
https://www.google.com/url?sa=t&source=web&rct=j&url=https://stackabuse.com/comparing-strings-using-JUMP_LINK__&&__python__&&__JUMP_LINK/%23:~:text%3DPython%2520has%2520the%2520two%2520comparison,refer%2520to%2520the%2520same%2520object.&ved=2ahUKEwj6zJvbhIbvAhWkwjgGHeDSAowQFjABegQIAhAF&usg=AOvVaw2YojBFtaKJK7omxZSTQIpt
"is" is comparing id
0
because two variable point to two different locations...
is : compare references
== : compare values