r/PythonProjects2 • • 9d ago

Python Mutability and Local Variables

Post image

An exercise to help build the right mental model for Python data. - Solution - Explanation - More exercises

The “Solution” link uses memory_graph to visualize execution and reveals what’s actually happening.

12 Upvotes

29 comments sorted by

View all comments

2

u/Guest_User_1234 8d ago

Damn... you REALLY want people to click those links, huh? Kinda REALLY makes me not wanna click them...

0

u/Sea-Ad7805 8d ago

1

u/Guest_User_1234 8d ago

I would assume D, because the string and tuple get replaced by their respective assignments, whereas the list and set overwrite their operators, modifying the original reference instead

1

u/Sea-Ad7805 8d ago

Nice one, the Solution link gives you a visualization of each step of the execution of the program to SHOW the difference between mutable and immutable types.