Right Mental Model for Python Data

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:

14 points · 8 comments · view on lemmy.world

8 Comments

ObsidianZed@lemmy.world · 7 pts · 312d (1 reply)

Well on one hand, I guessed correctly. (I'm not super familiar with Python)

On the other hand, that solution site is not exactly mobile friendly.

bterwijn@programming.dev · 1 pts · 312d

You are right, in landscape mode it's better, but still not ideal. It's a project I don't have time for now. On the other hand, did you run Python code, in an IDE where the debugger visualizes the whole program state, on your Phone before?

gigachad@piefed.social · 2 pts · 311d (1 reply)

Why can't it just return the result but has to use the same names in both scopes, I hate it

It's a nice exercise and a cool visualization though

bterwijn@programming.dev · 1 pts · 311d

The whole point is to practice Python Data Model concepts, it's not a best-way-to-code example, so feel free to hate.

synae@lemmy.sdf.org · 2 pts · 307d (1 reply)

It's D

bterwijn@programming.dev · 1 pts · 307d

Nice one.

moseschrute@lemmy.world · 1 pts · 312d (1 reply)

::: spoiler My guess

It’s C. And if that’s wrong, it has to be D. There is no way it’s A or B :::

bterwijn@programming.dev · 0 pts · 312d

C is incorrect,sorry. See the "Solution" link for the correct answer.