A hard exercise to help build the right mental model for Python data.

The “Solution” link visualizes execution and reveals what’s actually happening using 𝗺𝗲𝗺𝗼𝗿𝘆_𝗴𝗿𝗮𝗽𝗵: https://github.com/bterwijn/memory_graph

  • Daedskin@lemmy.zip
    link
    fedilink
    arrow-up
    1
    ·
    3 days ago

    Couldn’t get the solution page working on mobile (none of the buttons seemed to do anything); but my guess is it would be {1: []} due to |= silently using __or__ and an assignment, meaning b now holds a new reference

    • bterwijn@programming.devOP
      link
      fedilink
      arrow-up
      5
      ·
      3 days ago

      This is what the solution link is supposed to give you at the end of the execution animation:

      It’s hard to support all mobile browsers, on some it does work.