Question:medium

Which of the following operator evaluates to True if the variable on either side of the operator points towards the same memory location and False otherwise?

Show Hint

Use is to check if two variables are the same object,
and use == to check if their values are equal.
This is important when comparing mutable objects like lists or custom classes.
Updated On: Jan 14, 2026
  • is
  • is not
  • and
  • or
Show Solution

The Correct Option is A

Solution and Explanation

The Python is operator verifies object identity, returning True if two variables reference the identical memory address. This contrasts with the equality operator ==, which assesses value equivalence. For instance, two lists with identical content might not possess the same identity. The is not operator functions conversely, yielding True when variables do not share the same identity. Logical operators and and or operate on truth values, not memory locations. Consequently, the operator confirming if two variables point to the same in-memory object is is. Thus, option (A) is correct.
Was this answer helpful?
0