is and is not Operator in Python

Master Python with 70+ Hands-on Projects and Get Job-ready - Learn Python

Program 1

# IS and NOT IS Operator
# a=100
# b=100
# c=100
# a=a+10
# print(a is b)
# print(b is c)
# print(id(a))
# print(id(b))
# print(id(c))
# a=100
# b=120
# print( a is not b)
# s1="DataFlair"
# s2="DataFlair"
# print(id(s1))
# print(id(s2))

# print(s1 is not s2)
# mylist1=[1,2,3]
# mylist2=[1,2,3]
# print(type(mylist1))
# print(type(mylist2))
# print(id(mylist1))
# print(id(mylist2))
# print(mylist1 is mylist2)
a=True
b=True
# print(type(a))
# print(type(b))
print(id(a))
print(id(b))

print(a is b)

 

Did you like our efforts? If Yes, please give DataFlair 5 Stars on Google

courses

DataFlair Team

DataFlair Team provides high-impact content on programming, Java, Python, C++, DSA, AI, ML, data Science, Android, Flutter, MERN, Web Development, and technology. We make complex concepts easy to grasp, helping learners of all levels succeed in their tech careers.

Leave a Reply

Your email address will not be published. Required fields are marked *