Monday, 13 March 2023

Identity Operators

 Identity Operator

Python supports two types of identity operators and these are
  1. is operator
  2. is not operator

is operator

These operators are used for comparison of the memory locations of the objects. is operator returns True if both sides of the operator point to the same object and returns False if not.


a=85
b=a
print(a is b)
Output
True

is not operator

is not operator returns True if both sides of the operator does not point to same object and False if they point to same object. 
a=85
b=85
print(a is not b)
Output
False

0 comments:

Post a Comment

Note: only a member of this blog may post a comment.

Find Us On Facebook

python tutorial

More

C Programming

More

Java Tutorial

More

Data Structures

More

MS Office

More

Database Management

More
Top