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

ph923678 单选题 共 个子题

我们需要用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))
正在加载题目数据…
已答 /
子题
该题型需在试卷/作业中作答,单题练习暂不支持
答案解析
讨论
发布
登录后参与讨论 立即登录
发布讨论需先绑定并验证手机号 去绑定手机号
加载中…
我
我
回复 @
回复 @
发送
还没有人讨论,来发表第一条吧