Skip to content
Sharp

Functions · interview question

Which naming or modeling choice is strongest for return values?

Multiple choiceMediumchapter-2-curatedpremiumfunctionsreturn-values
python
def discount_rate(is_vip: bool, subtotal: float) -> float:
    if is_vip and subtotal >= 100:
        return 0.15
    return 0.0
Choose one answer
Answer and explanation

Correct answer

B. Use names and structures that describe the business fact directly instead of temporary implementation noise.

Why

Clear naming and modeling shorten debugging, review, and onboarding time.

Test yourself on Functions

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

Start free test
All Functions questions →