第29008题 单选题
以下实现简易商品结账模拟程序的Python代码中,符合题目需求的是?

我们需要用Python实现一个简易的商品结账模拟程序,具体需求如下:

  1. 从控制台读取两个正整数,分别为商品单价(单位:元)和购买数量
  2. 计算应收金额:单价 × 数量
  3. 如果应收金额大于100元,则减免10元后输出最终金额;否则直接输出应收金额
  4. 最终金额需保留1位小数输出
A
price = int(input("请输入商品单价:"))
count = int(input("请输入购买数量:"))
total = price * count
if total > 100:
    total -= 10
print("{:.1f}".format(total))
B
price = input("请输入商品单价:")
count = input("请输入购买数量:")
total = price * count
if total > 100:
    total -= 10
print("{:.1f}".format(total))
C
price = int(input("请输入商品单价:"))
count = int(input("请输入购买数量:"))
total = price * count
if total >= 100:
    total -= 10
print("{:.1f}".format(total))
D
price = int(input("请输入商品单价:"))
count = int(input("请输入购买数量:"))
total = price * count
if total > 100:
    total = total * 0.9
print("{:.1f}".format(total))
程序运行统计
暂无判题统计
提交0次 正确率0.00%
答案解析