Home >>Python Keywords >Python is Keyword

Python is Keyword

Python is Keyword

Python is keyword in python is used to test object identity whether two variables belong to the same object. When the two objects are the same the test will return true otherwise, it will return false.

Here is an example of Python is Keyword:

z = ["red", "blue", "green"]
a = z
print(z is a)

Output:
True
Example 2:

x = ["a", "b", "c"]
y = ["a", "b", "c"]
print(x is y)

Output:
False

No Sidebar ads