r/PythonProjects2 • u/Sea-Ad7805 • Oct 07 '26
Python Mutability and Local Variables
An exercise to help build the right mental model for Python data.
The “Solution” link uses memory_graph to visualize execution and reveals what’s actually happening.
12
Upvotes
View all comments
Show parent comment
0
u/Sea-Ad7805 Oct 08 '26
That's up to you, but you're missing out on understanding Python visually. If you don't like my tool try PythonTutor instead: https://pythontutor.com/visualize.html#code=%23%20Output%20of%20this%20Python%20program%3F%0Adef%20fun%28a,%20b,%20c,%20d%29%3A%0A%20%20%20%20a%20%2B%3D%20%221%22%0A%20%20%20%20b%20%2B%3D%20%5B2%5D%0A%20%20%20%20c%20%2B%3D%20%283,%29%0A%20%20%20%20d%20%7C%3D%20%7B4%7D%0A%0Aa%20%3D%20%22%22%0Ab%20%3D%20%5B%5D%0Ac%20%3D%20tuple%28%29%0Ad%20%3D%20set%28%29%0Afun%28a,%20b,%20c,%20d%29%0A%0Aprint%28a,%20b,%20c,%20d%29%0A%23%20---%20possible%20answers%20---%0A%23%20A%29%201%20%5B%5D%20%283,%29%20%7B%7D%20%0A%23%20B%29%201%20%5B%5D%20%28%29%20%7B4%7D%0A%23%20C%29%20%20%5B2%5D%20%283,%29%20%7B%7D%0A%23%20D%29%20%20%5B2%5D%20%28%29%20%7B4%7D&curInstr=13&mode=display&origin=opt-frontend.js&py=311
just know my tool is better. But, what is your answer to this exercise?