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