Python Identity Operators Example

identity operator python

There are used to compare the memory locations of two operators. Example: #!/usr/bin/python a = 20 b = 20 if ( a is b ): print “Line 1 – a and b have same identity” else: print “Line 1 – a and b do not have same identity” if ( id(a) == id(b) ): print … Read more

Python Comparison Operators Example

Comparison operators

These operators compare the values on either sides of them and decide the relation among them. They are also called Relational operators. Example: #!/usr/bin/python a = 21 b = 10 c = 0 if ( a == b ):    print “Line 1 – a is equal to b” else:    print “Line 1 – … Read more