Code Room
Code reviewMedium
Question
Review this Python merge of per-shard counters.
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.
Learn the concepts
def merge(shards): totals = {} for shard in shards: for k, v in shard.items(): keys = list(totals.keys()) # snapshot keys each time if k in keys: totals[k] = totals[k] + v else: totals[k] = v return totalsRun or narrate your approach, then ask the coach.