+ 3
Whatâs the difference between âisâ and â==â in Python?
a = 'SoloLearn' b = 'SoloLearn' print(a == b) >>>True print(a is b) >>>True a = ['SoloLearn'] b = ['SoloLearn'] print(a is b) >>>False print(a == b) >>>True
2 Answers
+ 6
== is for value equality. It's used to know if two objects have the same value. is is for reference equality. It's used to know if two references refer (or point) to the same object, i.e if they're identical.
+ 4
You'll find detailed info of operators here đ
https://realpython.com/JUMP_LINK__&&__python__&&__JUMP_LINK-operators-expressions/