Skip to main content

Identity Operators


Operators

Description

Is

Returns true if identity of two operands are same, else false

is not

Returns true if identity of two operands are not same, else false.

Example Program:

a=20 

b=20 

if( a is b): 

    print("a,b have same identity")

else:   

    print("a, b are different")

b=10 

if( a is not b): 

    print('a,b have different identity')

else: 

    print("a,b have same identity")

Output:

a,b have same identity

a,b have different identity

 

 

Comments