문제 › 940

940. [코드리뷰] 주문 합계 계산

Medium 코드리뷰 CodeReview
문제 설명
주문 합계를 계산하는 함수 PR을 리뷰하세요.
리뷰할 코드 (python)
def order_total(items, coupon):
    total = 0
    for x in items:
        price = get_price(x["id"])
        total = total + price * x["qty"]
    if coupon:
        total = total - get_coupon(coupon)["amount"]
    return total
로그인하고 풀기 AI가 자동 채점하고 즉시 정답·해설을 알려줘요. 무료.