0% found this document useful (0 votes)
4 views1 page

Customer Discount and Order Status Logic

Uploaded by

jahnman9925
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views1 page

Customer Discount and Order Status Logic

Uploaded by

jahnman9925
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

def calculate_discount(customer_type, total_amount): if customer_type == "regular": if

total_amount > 1000: return total_amount * 0.05 else: return 0 elif customer_type == "premium":
return total_amount * 0.1 elif customer_type == "vip": if total_amount > 5000: return
total_amount * 0.2 else: return total_amount * 0.1 else: raise ValueError("Unknown customer
type") def update_order_status(order): if order["status"] == "pending": if order["paid"]:
order["status"] = "processing" else: order["status"] = "awaiting_payment" elif order["status"] ==
"processing": if order["items_available"]: order["status"] = "shipped" else: order["status"] =
"backorder" return order["status"]

You might also like