我写了一个简单的计算,但是得到的值与样本不同。 Python明显如何四舍五入?
PriceListOld = 23
PriceListNew = []
if PriceListOld <=20:
PriceListNew = PriceListOld * 0.8
elif PriceListOld >20 and PriceListOld <=50:
PriceListNew = PriceListOld * 0.6
elif PriceListOld >50:
PriceListNew = PriceListOld * 0.4
print(PriceListNew)
print(23 -(4*2.3)) #<-- This is the Sample.