LectureMoment
← LectureMoment

How Python Actually Behaves · Intermediate

How Python Actually Behaves — Intermediate

20 practice questions on How Python Actually Behaves. Every question is written from a specific moment in a real lecture, and after you answer it links to that exact timestamp so you can check it yourself.

What this pack asks

The free questions in this pack. Answer choices and explanations appear as you play.

  • A module defines x = "global x" at top level, plus: … Calling level_two("yes") works fine, but level_two("") raises UnboundLocalError instead of falling back to the module-level value. Why?

    Answer this one →
  • A function logs a line, then returns from inside a with block: … The log shows "returning", then "closing" from the cleanup, and only then does the caller's next line run. Why does cleanup happen after the return statement was already executed?

    Answer this one →

Written from lectures by mCoding. Not affiliated with or endorsed by any university, channel, creator or certification program.