What will be the output of the following Python code?
l=[2, 3, [4, 5]] l2=l.copy() l2[0]=88 l l2
The code shown above depicts deep copy. In deep copy, the base address of the objects is not copied. Hence the modification done on one list does not affect the other list.
- [88, 2, 3, [4, 5]] [88, 2, 3, [4, 5]]
- [2, 3, [4, 5]] [88, 2, 3, [4, 5]
- [88, 2, 3, [4, 5]] [2, 3, [4, 5]]
- [2, 3, [4, 5]] [2, 3, [4, 5]]
Correct Answer:
[2, 3, [4, 5]] [88, 2, 3, [4, 5]
need an explanation for this answer? contact us directly to get an explanation for this answer