Identity Operators in Python | Types of Identity Operators | Python tutorials online

Опубликовано: 19 Октябрь 2024
на канале: ViaDigitally
107
2

#IdentityOperators #TypesofIdentityOperators #PythonTutorials

identity operators in python
These operators are used to identify both the objects are same location or different location
python supports 2 types of identity operators:
These are:
1. #IsOperator
2. #IsNotOperator
1. is operator:
if it returns True, both the objects are pointing same location.
if it returns False, both the objects are pointing different locations.
ex-1:
a=10
b=20
c=10
print(a is c)
print(a is b)
print(c is b)

2. is not operators:
if it returns True, then both are pointing to different locations.
if it returns False , then both are point to same locations.
ex:
a=10
b=20
c=30
print(a is not b)
print(a is not c)
print(c is not b)
ex=2: '''
x='python'
y='c'
z='java'
a='c'
print(x is a)
print(y is a )
print(z is a)
print(z is not y)

id():
This function is used to returns the address of the variable:
syntax:
id(variable)
ex:
a=10
print(a)
print(type(a))
print(id(a))
------------------------------------

►THANKS for taking the time to visit, I hope you SUBSCRIBE and enjoy the upcoming videos!

►Please SUBSCRIBE for More videos:
   / viadigitally  

►If you like this video, Please click on Like and Comment!

►Follow Us on Social Network:

►Facebook:   / viadigitally  
►Twitter:   / viadigitally  
►LinkedIn:   / viadigitally  
► Instagram:   / viadigitally  

Python tutorial for beginners| python programming language tutorial
Python basics | python tutorial for beginners | learn python programming from scratch
Python tutorial for beginners - learn python for machine learning and web development.
Python tutorial for beginners | python programming | learn python | great learning.
Python tutorial for beginners [full course] learn python for web development.