Code Room
Code reviewMediumcr-g476
Subject Repeated workLevel Mid–Senior~18 minCommon in Code quality & review interviewsIndustries Software development

Question

Review this Python pricing loop.

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
class Cart:    @property    def tax_rate(self):        # hits the rules engine; not cheap        return load_tax_rules(self.region).effective_rate()     def total(self):        running = 0.0        for item in self.items:            running += item.price * (1 + self.tax_rate)        return running
Run or narrate your approach, then ask the coach.