Tuesday, April 23, 2024

📑 Copying Lists

📑 Task

1) What will the program print?
2) Make a list of identical elements and copy this list
so that the result of the last three lines looks different:
[[1], [], []] [[2], [], []]

📑 Answer

1) 2 lists of empty lists: [[], [], []] [[], [], []]
2 identical lists of elements: [[1, 2], [1, 2], [1, 2]] [[1, 2], [1, 2], [1, 2]]
2)

No comments:

Post a Comment