What is the use of the "is not" keyword in Python?

The "is not" keyword in Python is used to check if two variables are not pointing to the same object. The "is not" operator returns True if the objects referred to by the variables are different, and False if they are the same. For example:

a = [1, 2, 3]
b = [1, 2, 3]

print(a is b) # False
print(a is not b) # True

In the above example, **a** and **b** are two separate lists with the same values, but they are not the same object. So **a** **is not b** is True.

Related Questions You Might Be Interested