Code RoomProperty called in loop
MediumPrep Room Coding #2101

Property called in loop

Code reviewCode quality & reviewMid–Senior~18 min

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.

0:00 of about 18 min
Mark a line and say what kind of problem it is.0 findings
1class Cart:
2 @property
3 def tax_rate(self):
4 # hits the rules engine; not cheap
5 return load_tax_rules(self.region).effective_rate()
6 
7 def total(self):
8 running = 0.0
9 for item in self.items:
10 running += item.price * (1 + self.tax_rate)
11 return running
Which questions mattered is sealed until you submit. Telling you now would just be handing over the edge cases.