Questenaتدريب يوضح لك ما ينبغي مراجعته لاحقًا
السؤال 26

After `items = [1]` and `items.append([2, 3])`, what is `items`?

  1. `[1, 2, 3]`
  2. `[1]` because append returns no value
  3. `[1, [2, 3]]`الإجابة الصحيحة
  4. `[[1], [2], [3]]`

الشرح

The argument to `append` becomes one new final element even though that argument is itself a list. Adding its two contents separately would be the behavior of `extend`, not `append`.

تابع هذا الاختبار

بدء التدريب
السؤال 26: After `items = [1]` and `items.append([2, 3])`, what is… · Python Fundamentals · Questena