Questenaتمرینی که نشان می‌دهد بعد چه چیزی را مرور کنید
سؤال 40

A dictionary literal lists the same equal key twice, first with value 1 and later with value 2. Which value is retained for that key?

  1. Both values are retained under duplicate entries.
  2. Value 1 is retained because the earliest entry wins.
  3. Neither value is retained because SyntaxError occurs.
  4. Value 2 is retained because the later entry wins.پاسخ درست

توضیح

A dictionary has only one entry for a given equal key, and the later value replaces the earlier one while the literal is built. Duplicate equal keys do not coexist and do not cause a syntax failure.

ادامهٔ این آزمون

شروع تمرین
سؤال 40: A dictionary literal lists the same equal key twice, first… · Python Fundamentals · Questena