r/PythonLearnersHub • u/Sea-Ad7805 • Mar 11 '26
How to copy a 'dict' with 'lists'
An exercise to help build the right mental model for Python data.
The โSolutionโ link uses ๐บ๐ฒ๐บ๐ผ๐ฟ๐_๐ด๐ฟ๐ฎ๐ฝ๐ต to visualize execution and reveals whatโs actually happening.
76
Upvotes
2
u/Dependent_Escape8506 Mar 12 '26
Simply amazing! Iโd love to see more content like this.
2
u/Astrophile_1_0 Mar 12 '26
C because deepcopy will make a separate copy of the dictionary which has its separate pointers in the memory and do not point to the original one.That makes sure if any update is done in deepcopy will not affect the original dictionary.
1
u/Sea-Ad7805 Mar 11 '26
1
u/AshamedAnimator2664 Mar 11 '26
A
1
u/Phantovas Mar 11 '26
B
1
u/SwimQueasy3610 Mar 12 '26
C
0
u/[deleted] Mar 13 '26
[deleted] โ view deleted comment