+ 5
Why are the outputs not matching for same code on different compilers.
a=500 b=500 print(a is b) output by python 3.7 idle ( installed from python.org) is: False output by online ide of python 3.6 like codechef,geeksforgeeks is: True
3 ответов
+ 8
A very good explanation:
https://stackoverflow.com/questions/306313/is-operator-behaves-unexpectedly-with-integers
(Personally I prefer the second answer better than the marked as best one)
+ 6
a is b dont check if they store same content . Checks id of element. The answer can be undefined.
Try a==b for comparing integers
+ 4
Kuba Siekierzyński me too