Logo

Question preview

Wannabe 3

What this preview is

About this preview

Wannabe 3 is a hard 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 type-checking question tests

This is a hard question about Python's type system and how static type checkers interpret code that may appear ambiguous or underspecified. It requires familiarity with the gap between what a typechecker can prove and what Python's runtime actually permits.

To answer correctly, you need to reason through which type violations a tool like mypy or Pyright would actually flag, and which ones it would silently accept—either because the code is genuinely type-safe, or because the checker lacks enough context to raise an error. This tests your understanding of type inference, implicit conversions, and the boundaries of static analysis in a dynamically-typed language.

  • Type inference and variable narrowing
  • Implicit vs. explicit type coercion
  • Typechecker limitations and any-type fallbacks
  • Union types and type guards