Skip to main content
It looks like you're using Internet Explorer 11 or older. This website works best with modern browsers such as the latest versions of Chrome, Firefox, Safari, and Edge. If you continue with this browser, you may see unexpected results.

Python for Basic Data Analysis: 1.11 Identity operators

Get started on your learning journey towards data science using Python. Equip yourself with practical skills in Python programming for the purpose of basic data manipulation and analysis.

Identity operators 

Identity operators 

We use identity operators to compare the memory location of two objects.

Operator Syntax Description
is x is y This returns  True  if both variables are the same object 
is not x is not y This returns  True  if both variables are not the same object 

Example

Exercises

Use the operators to evaluate the following.

Qn Equation True or False?
1

x = 200
y = 500
z = y

print(z is y)

 True  or   False 
2 x = 200
y = 500
z = y

print(x is not y)
 True  or   False 

Video Guide