- Identity operator, before going to identity operator let's have a small idea about its background.
- We have multiple operators from them special operator is the one, in that special operator we are having two types of operators :
- 1.Identity operator.
- 2.Membership operator.
- Now let's talk about the identity operator,
- "Identity operator" is used to compare whether the value in the first argument may be or may not be the same in the second argument.
- In identity operator we have two types, they are:
- is not
- "is" operator is used to saying that the value is present in the corresponding argument.
- If the value is present in the corresponding argument then it returns True, else False.
- is operator always checks the address comparison
- "is not " operator is used to saying that the value is not present in the corresponding argument.
- If the value not presents then it returns the True otherwise False.
Example: write a python program using is identity operator.
#2.write a python program using isnot operator.
- print(a isnot b)