Code Room
Code reviewMedium
Question
Review this Python payment-capture helper.
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 capture_payment(charge_id): try: resp = gateway.capture(charge_id) db.mark_captured(charge_id, resp.txn_id) return True except Exception: pass return False def run_batch(charge_ids): results = {} for cid in charge_ids: results[cid] = capture_payment(cid) return resultsRun or narrate your approach, then ask the coach.