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

For `data = dict(red=4)`, which expression is true because dictionary membership examines keys?

  1. Only `4 in data`
  2. Both `"red" in data` and `4 in data`
  3. Only `"red" in data`پاسخ درست
  4. Neither expression, because membership is unsupported

توضیح

The membership operator checks the dictionary's keys, making `red` a match and leaving the mapped value 4 irrelevant to this test. Searching values or both sides of each mapping would require a different expression.

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

شروع تمرین
سؤال 43: For `data = dict(red=4)`, which expression is true because… · Python Fundamentals · Questena