← Quiz: References and Copying: all 10 questions
Quiz: References and Copying · Question 8 of 10
Which call copies a nested list so that no inner list is shared?
Which call copies a nested list so that no inner list is shared?
- A.a.copy()
- B.a[:]
- C.list(a)
- D.copy.deepcopy(a)
Answer & explanation
Correct answer: copy.deepcopy(a)
The first three are shallow copies. Only deepcopy copies the inner objects too.
Can you get the rest right without peeking?
Take the timed Quiz: References and Copying quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →