r/PythonLearning • • 19d ago

Python List Operations and Aliasing

Post image

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.

0 Upvotes

2 comments sorted by

0

u/Over_Supermarket_140 16d ago

This is shallow copy in action, right?

1

u/Sea-Ad7805 15d ago

Yes, that's one way of looking at it, another is that b + [4] creates a new value that is then assigned to b.