Skip to content
Sharp

Code Quality · interview question

A bug appears around mypy feedback. What is the strongest first debugging move?

Multiple choiceMediumchapter-10-curatedpremiumcode-qualitymypy-feedback
python
def subtotal(lines: list[float]) -> float:
    return sum(lines)
Choose one answer
Answer and explanation

Correct answer

A. Trace one concrete example, inspect the state transitions, and compare them to the intended rule before rewriting anything.

Why

That approach is reliable because it creates evidence. Ignoring mypy entirely often leaves refactors depending on luck and manual re-reading.

Test yourself on Code Quality

A free test with instant, explained results. No account needed.

Start free test
All Code Quality questions →