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 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 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

25th Feb 2021, 9:59 PM
Amir
Amir - avatar
3 Answers
+ 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
25th Feb 2021, 10:02 PM
Abhay
Abhay - avatar
0
because two variable point to two different locations... is : compare references == : compare values
25th Feb 2021, 10:18 PM
visph
visph - avatar