The following table lists the identity operators supported by all Python languages.
Example:
Try the following example to understand the identity operators provided by all Python programming languages:
#!/usr/bin/pythona = 20b = 20if (A is b): print "line 1-a and B has same identity" else: print "line 1-a and b does not have same identity "if (ID (a) = = ID (b)): print" line 2-a and B has same identity "else: print" Line 2 -A and B do not have the same identity "B = 30if (A is b): print" line 3-a and B has same identity "else: print" Line 3-a and B does not have the same identity "if (A is not B): The print" line 4-a and B does not have same identity "else:< C7/>print "line 4-a and B has same identity"
When executing the above program it produces the following result:
Line 1-a and B has same identityline 2-a and B has same identityline 3-a and b do not have same identityline 4-a and b do not have same identity