Python 语法求助

Python 语法求助,第1张

Python 语法求助
 
price = float(input('商品单价:'))
num = int(input('商品数量:'))
total = float(price * num)
print('总计:%.2f' % total)
Payment = input('现金:没有折扣n微信:0.95折n支付宝:鼓励金付款金额的10%   鼓励金可以直接折算到付款金额中n刷卡:满100-20n')
if Payment == '现金':
    print('应付:%.2f' % total)
elif Payment == '微信':
    print('应付:%.2f' % total*0.95)
elif Payment == '支付宝':
    print('应付:%.2f' % total*)
elif Payment == '刷卡':
    if total > 100:
        print('应付:%.2f' % total - 20)
    else:
        print('应付:%.2f' % total)
else:
    print('输入错误')

这段代码老是显示:can't multiply sequence by non-int of type 'float'

应该怎么去修改他呢?

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/zaji/5689472.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-12-17
下一篇2022-12-17

发表评论

登录后才能评论

评论列表(0条)

    保存