Code Room
Code reviewHardcr-g337
Subject Floating pointLevel Senior–Staff~22 minCommon in Code quality & review interviewsIndustries Software development

Question

Review this Python that verifies a posted-then-reversed fee leaves a large account balance unchanged, as an end-of-day integrity check.

What a strong answer looks like

Separate real bugs from style. Rank issues by severity, point at the root cause rather than the symptom, and suggest a concrete fix — specific and kind.

Talk through your review
Code to reviewpython
def apply_fee(balance, fee):    return balance + fee def reverse_fee(balance, fee):    return balance - fee def net_zero(balance, fee):    # balance like 1e16, fee like 0.07    after = apply_fee(balance, fee)    restored = reverse_fee(after, fee)    return restored == balance # net_zero(1e16, 0.07) -> expected True
Run or narrate your approach, then ask the coach.