需要手动输入销售价,出厂价和运费,然后算出图中的p值,根据p值的范围确定最后的费用

代码如下,如有帮助,望采纳
xs_price = float(input('请输入销售价:'))
ch_price = float(input('请输入出厂价:'))
yf = float(input('请输入运费:'))
p = (xs_price-ch_price-yf)/ch_price
if p <= 0.2:
print(0.1*p)
elif p>0.2 and p<=0.3:
print(0.12*p)
else:
print(0.16*p)