Logo

Question preview

Do this then that

What this preview is

About this preview

Do this then that is a medium quant interview question on language knowledge in Python.

Unlock full access to getcracked

Join to unlock this question, detailed solutions, and our complete library of quant finance interview prep.

What this Python code-reading question tests

This is a medium-difficulty code-reading question that asks you to trace execution and predict output. It probes your ability to read unfamiliar Python code quickly and accurately—a skill that matters in live coding interviews and in roles where you must reason about legacy systems or parse others' implementations.

To work through questions like this, read the code systematically, track variable state as it changes, and pay careful attention to control flow, operator precedence, and any non-obvious language semantics. The goal is to build confidence in reading code under time pressure without running it yourself.

  • Control flow and branching
  • Variable assignment and mutation
  • Python operator behaviour and evaluation order