What this Python output-prediction question tests
This is an easy Python question that asks you to read a code snippet and predict its output. It directly tests your familiarity with Python's syntax, operator precedence, and built-in functions.
Questions of this type are common in technical interviews because they reveal how carefully a candidate reads code and whether they understand how Python evaluates expressions. Even experienced developers can stumble if they misremember operator behaviour or the exact semantics of a language feature. The best approach is to trace through the code mentally or on paper, one line at a time, keeping track of variable state and return values.
- Python operator precedence and associativity
- Built-in function behaviour
- String and numeric type coercion
- Control flow and function calls