| Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|---|
| 50539 | 韩逸宸 | 2023经开区信息技术合格性考试-1 | Python3 | 解答错误 | 0 | 41 MS | 4460 KB | 565 | 2024-12-24 15:09:40 |
def calculate_discount(total_amount): if total_amount < 2000: discount = 0 elif 2000 <= total_amount < 3000: discount = 0.20 # 8折优惠,即20%的折扣 elif 3000 <= total_amount < 4000: discount = 0.30 # 7折优惠,即30%的折扣 else: discount = 0.40 # 6折优惠,即40%的折扣 return total_amount * (1 - discount) # 测试程序 total_amount = float(input("请输入您的购物总金额:")) discounted_price = calculate_discount(total_amount) print(f"{discounted_price:.1f}")