首页 > 代码库 > Python基础(2)分段计算利润

Python基础(2)分段计算利润

lirun=int(raw_input(‘input‘))
if lirun <=10:
    jiangjin=lirun * 0.1
    print ‘your jinagjin is‘,jiangjin
elif (lirun> 10 )and (lirun <=20):
    jiangjin=10*0.1+(lirun-10)*0.075
    print jiangjin
elif (lirun>20) and (lirun <=40):
    jiangjin=0.05*(lirun-20)
    print jiangjin

Python基础(2)分段计算利润