Skip to content
Sharp

Type Hints · interview question

A bug appears around function type hints. What is the strongest first debugging move?

Multiple choiceEasychapter-10-curatedpremiumtype-hintsfunction-type-hints
python
def shipping_fee(subtotal: float) -> float:
    return 0 if subtotal >= 100 else 6.5
Choose one answer
Answer and explanation

Correct answer

D. 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. Mechanical hints that do not improve the contract still leave the reader guessing what the function really promises.

Test yourself on Type Hints

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

Start free test
All Type Hints questions →