PRACTICE / UNDERSTAND / REPEAT

Python: Equality & identity

Practice equality & identity with self-contained questions. Check your answer, then use the explanation to understand the reasoning.

21 questionsAnswers explainedFree · no login
Question 1 of 21
Equality & identity · MCQQuestion link ↗

Which operator checks whether two names refer to the same object?

Choose one answer
Answer & explanation

Answer: is

`is` tests object identity. `==` tests equality according to the objects’ equality behavior.