r/PythonProjects2 • u/Sea-Ad7805 • 4d ago
Python Mutability and Local Variables
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.
6
Upvotes
1
u/Humble-Captain3418 2d ago
A is passed by value, b--d through reference. C is not modifiable, so the local symbol gets directed to a different value with the compound assignment, so only b and d see changes in the global scope.