QuestenaՎարժանք, որը ցույց է տալիս՝ ինչ կրկնել հաջորդիվ
Հարց 35

Two distinct objects compare equal. If one is an element of `items`, what does `value in items` use to find it?

  1. Only whether `value` is a valid index
  2. Equality against the elementsՃիշտ պատասխան
  3. Only object identity against the elements
  4. The textual type names of the elements

Բացատրություն

List membership checks whether an element compares equal to the sought value, so distinct identity does not prevent a match. Testing indexes or requiring the exact same object would use criteria that `in` does not apply to lists.

Շարունակեք այս թեստով

Սկսել վարժանքը
Հարց 35: Two distinct objects compare equal. If one is an element of… · Python Fundamentals · Questena