MWZ

MINDWAREZONE

Identity Operators in python

Identity operators check whether two variables refer to the same object.

Operator Description
is Returns True if objects are identical
is not Returns True if objects are not identical

Example

x = [1, 2] 
y = x 
print(x is y) 
print(x is not y)
            

Output:

True 
False