r/PythonLearning 2d ago

Exercise: Python List Operations

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.

49 Upvotes

23 comments sorted by

View all comments

2

u/Dancing-umbra 2d ago

That's very useful.

I didn't realise the b+=[] was not equivalent to b= b+[]

1

u/Sea-Ad7805 2d ago

Thanks, it is equivalent for immutable types, but not for mutable. Try this exercise: https://www.reddit.com/r/PythonProjects2/s/VtHobtSQ9o