+ 1

Difference between '==' and 'is'

i made a simple if program : x = 'foo' y = 'egg' if x is y: print("x&y is the same") elif y is x: print("y&x is the same") else: print("both are same") so what's the difference between == and is operator? Edit : i can't still figure it out

26th Jul 2016, 11:41 AM
Erlangga Ibrahim
Erlangga Ibrahim - avatar
3 Answers
+ 4
Is is only used for strings while == can be used anywhere and it is more comfortable to.(If you get it leave a mark up if you don't email ivansing23@gmail.com)
28th Jul 2016, 8:26 AM
Ivan
Ivan - avatar
0
hi!
2nd Sep 2016, 6:12 PM
arun kumar
arun kumar - avatar
0
"==" means equivalent, "is" means exactly the same.
15th Nov 2016, 7:15 PM
ZzzzHhhhEeee
ZzzzHhhhEeee - avatar