What does the is operator check in Python?
-
A
Whether two values are equal
-
B
Whether two variables reference the same object
Correct answer
-
C
Whether a value is of a given type
-
D
Whether a value is None only
Correct answer
B. Whether two variables reference the same object
10 views
Explanation
is compares object identity, while == compares values.
Doubts & discussion
Not sure why the answer is B? Ask here and get an explanation.
Ask a doubt about this MCQ