# 电商客服岗 - 订单优惠判定程序 # 步骤1:接收客服录入的订单金额 order_amount = float(input("请输入顾客消费金额(元):")) # 步骤2:单分支判断是否满足优惠条件 if order_amount >= 200: print(f" 订单金额{order_amount:.2f}元,已激活会员9折优惠!") # 步骤3:程序结束提示 print("优惠判定完成,可同步告知顾客~") |
# 电商客服岗 - 订单优惠判定程序(AI优化版) try: # 输入校验:避免非数字输入 order_amount = float(input("【客服录入】请输入顾客消费金额(元):")) if order_amount < 0: print("提示:金额不能为负数,请重新录入!") else: # 单分支核心判断 if order_amount >= 200: discount = order_amount * 0.1 # 计算优惠金额 print(f"订单金额{order_amount:.2f}元,已激活会员9折优惠!") print(f"优惠后金额:{order_amount - discount:.2f}元") print("优惠判定完成,可同步告知顾客~") except ValueError: print("提示:请输入有效数字(如200、199.5)!") |