【发布时间】:2022-01-16 12:58:13
【问题描述】:
我正在尝试在 python 中为硬件计算账单。无法弄清楚如何将数字四舍五入到小数点后两位。这是我到目前为止所拥有的。每次我尝试圆形功能时,它都不起作用并给我一条错误消息。救命?!
ss_cost = 3.95 * 2
hb_cost = 8.95 * 2
ds_cost = 2.50 * 2
subtotal = (ss_cost) + (hb_cost) + (ds_cost)
tax = (round(subtotal * 0.0475), %.2)
print (tax)`
【问题讨论】: