简单练习 企业发放的奖金根据利润提成。

# 企业发放的奖金根据利润提成。利润(I)低于或等于10.5万元时,奖金可提10%;利润高
# 于10.5万元,低于20.5万元时,低于10.5万元的部分按10%提成,高于10.5万元的部分,可可提
# 成7.5%;20.5万到40.5万之间时,高于20.5万元的部分,可提成5%;40.5万到60.5万之间时高于
# 40.5万元的部分,可提成3%;60.5万到100.5万之间时,高于60.5万元的部分,可提成1.5%,高于
# 100.5万元时,超过100.5万元的部分按1%提成,从键盘输入当月利润I,求应发放奖金总数?

profit=int(input('从键盘输入当月利润/万元'))
performance=0
if profit<=10.5:
    performance=0.1*profit
elif 10.5<profit<=20.5:
    performance = 10.5*0.1+0.075 * (profit-10.5)
elif 20.5<profit<=40.5:
    performance = 10.5*0.1+0.075 * (20.5-10.5)+(profit-20.5)*0.05
elif 40.5<profit<=60.5:
    performance = 10.5*0.1+0.075 * (20.5-10.5)+(40.5-20.5)*0.05+(profit-40.5)*0.03
elif 60.5<profit<=100.5:
    performance = 10.5*0.1+0.075 * (20.5-10.5)+(40.5-20.5)*0.05+(60.5-40.5)*0.03+(profit-60.5)*0.015
elif 100.5<profit:
    performance =10.5*0.1+0.075 * (20.5-10.5)+(40.5-20.5)*0.05+(60.5-40.5)*0.03+(100.5-60.5)*0.015+(profit-100.5)*0.01
else:
    print('您输入有误,请重新检查')
print('应发放奖金总数%s万元'% performance)

猜你喜欢

转载自blog.csdn.net/jn10010537/article/details/80307873