以下哪个Python代码片段可以正确实现简易购物找零的模拟功能?

py399336 单选题 共 个子题

题目需求:实现一个简易购物找零模拟程序,需依次接收两个正整数输入,第一个为商品总价,第二个为用户支付金额。当支付金额大于等于商品总价时,输出应找零的金额;当支付金额不足时,输出"金额不足,无法购买"。

A
total = int(input())
paid = int(input())
if paid < total:
    print(paid - total)
else:
    print("金额不足,无法购买")
B
total = int(input())
paid = int(input())
if paid >= total:
    print(paid - total)
else:
    print("金额不足,无法购买")
C
total = input()
paid = input()
if paid >= total:
    print(paid - total)
else:
    print("金额不足,无法购买")
D
paid = int(input())
total = int(input())
if paid >= total:
    print(paid - total)
else:
    print("金额不足,无法购买")
正在加载题目数据…
已答 /
子题
该题型需在试卷/作业中作答,单题练习暂不支持
答案解析
讨论
发布
登录后参与讨论 立即登录
发布讨论需先绑定并验证手机号 去绑定手机号
加载中…
我
我
回复 @
回复 @
发送
还没有人讨论,来发表第一条吧