Code Room
Code reviewHardcr-g278
Subject RoundingLevel Senior–Staff~20 minCommon in Code quality & review interviewsIndustries Software development

Question

Review this Python reconciliation check that a list of per-strategy allocation fractions sums to 1.0 before placing orders.

`weights` are fractions like `[0.1, 0.2, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1]` that mathematically total 1.0.

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 is_fully_allocated(weights):    total = 0.0    for w in weights:        total += w    return total == 1.0 def place_book(weights, orders):    if not is_fully_allocated(weights):        raise ValueError("allocation must sum to 100%")    for w, o in zip(weights, orders):        submit(o, size=w)
Run or narrate your approach, then ask the coach.