Code Room
Code reviewMediumcr-g354
Subject Missing validationLevel Mid–Senior~20 minCommon in Code quality & review interviewsIndustries Software development

Question

Review this Python checkout endpoint. The team says 'the React form already validates quantity and price before submit.'

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
@app.post('/cart/checkout')def checkout():    body = request.get_json()    total = 0    for item in body['items']:        # price and qty validated in the browser form        total += item['price'] * item['quantity']    order = create_order(user_id(), items=body['items'], total=total)    charge(user_id(), total)    return jsonify({'order_id': order.id})
Run or narrate your approach, then ask the coach.