K12教育赛事综合服务平台
聚乐之家官方网站
下载聚乐之家官方App
专注青少年竞赛题库网站
需求为:模拟简易购物总价计算,首先输入商品单价和购买数量,计算总金额;若总金额达到或超过100元,则减免10元后输出最终金额;否则直接输出总金额。
price = float(input("请输入商品单价:")) count = int(input("请输入购买数量:")) total = price * count if total >= 100: total -= 10 print("最终总金额:", total)
price = float(input("请输入商品单价:")) count = int(input("请输入购买数量:")) total = price * count if total > 100: total -= 10 print("最终总金额:", total)
price = float(input("请输入商品单价:")) count = int(input("请输入购买数量:")) total = price + count if total >= 100: total -= 10 print("最终总金额:", total)
price = float(input("请输入商品单价:")) count = int(input("请输入购买数量:")) total = price * count if total >= 100: total += 10 print("最终总金额:", total)