Code Room
Code reviewMediumcr-g013
Subject Thread safetyLevel Mid–Senior~22 minCommon in Concurrency interviewsIndustries Software development

Question

Review this Python balance-update used by a thread pool.

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 Wallet:    def __init__(self):        self.balance = 0     def deposit(self, amt):        self.balance += amt     def withdraw(self, amt):        if self.balance >= amt:            self.balance -= amt            return True        return False
Run or narrate your approach, then ask the coach.