🔥Limited Offer: Get 50% OFFon AI & Full Stack Courses🔥
Back to Python Notes
Topic #31

Identity Operators


Identity Operators

Identity operators are used to compare the objects, not if they are equal, but if they are actually the same object, with the same memory location:

Operator Description Example Try it
is Returns True if both variables are the same object x is y
is not Returns True if both variables are not the same object x is not y

Examples

Example

x = ["apple", "banana"]
y = ["apple", "banana"]
z = x

print(x is z)
print(x is y)
print(x == y)

Example

x = ["apple", "banana"]
y = ["apple", "banana"]

print(x is not y)

Difference Between is and ==

  • is - Checks if both variables point to the same object in memory
  • == - Checks if the values of both variables are equal

Example

x = [1, 2, 3]
y = [1, 2, 3]

print(x == y)
print(x is y)

Want to go beyond the notes?

Join CodingNow 2.0's Python course — live mentorship, real projects, and 100% placement support.

Enroll Now — Free Demo Available

Identity Operators – FAQs

Quick answers about learning Identity Operators in Python.

This free note from CodingNow 2.0 explains Identity Operators in Python — concept, syntax and worked code examples you can copy, run and revise before interviews.
Yes. Every Python topic on CodingNow 2.0, including Identity Operators, is 100% free with no signup required.
With focused practice, most students grasp Identity Operators in 1–3 days from these notes; pairing it with CodingNow 2.0's mentor-led course takes you to job-ready depth faster.
Use the code examples in this note, then ask doubts for free on the CodingNow 2.0 Community (/community) — expert instructors answer within 24 hours.
WhatsApp
Call NowEnroll Now