Identity operators are used to compare the objects, not if they are equal, but if they are actually the same object, with the same memory location. th operators test if the two operands share an identity. We have two identity operators is and is not. The is operators test If two operands have the same identity, it returns True. Otherwise, it returns False.
This program is about comparing the equality of objects in Python.
""" is is not """ a = [1, 2] b = [1, 2] c = a print(id(a)) print(id(c)) print(id(b)) print(a is c) print(a is b) print(a==b) print(a is not c) print(a is not b) print(a!=b)To download raw file Click Here
2541201282048 2541201282048 2541201303616 True False True False True False
Learn All in Tamil © Designed & Developed By Tutor Joes | Privacy Policy | Terms & Conditions