QuestenaПрактика, после которой понятно, что повторить
Вопрос 52

Spot the accurate distinction between `a == b` and `a is b` in Python comparisons.

  1. Both operators always perform the same test.
  2. Identity converts both operands before comparing values.
  3. Equality compares values; identity tests whether the object is the same.Правильный ответ
  4. Equality checks memory location; identity compares converted values.

Объяснение

Equality delegates to value-comparison semantics, whereas identity asks whether both references designate one object. Treating `is` as a stricter value conversion obscures that it answers a different question rather than applying a stronger equality rule.

Продолжить работу с тестом

Начать тренировку
Вопрос 52: Spot the accurate distinction between `a == b` and `a is b`… · Python Fundamentals · Questena