Code Room
Code reviewMediumcr-g113
Subject Floating pointLevel Mid–Senior~25 minCommon in Code quality & review interviewsIndustries Software development

Question

Review this Python loop that steps through a range by 0.1 and checks for a target.

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 hit_target(start, stop, step, target):    x = start    while x <= stop:        if x == target:            return True        x += step    return False # hit_target(0.0, 1.0, 0.1, 0.3)
Run or narrate your approach, then ask the coach.