python分段算利润、税收

'''
题目:企业发放的奖金根据利润提成。
利润(I)低于或等于10万元时,奖金可提10%;
利润高于10万元,低于20万元时,低于10万元的部分按10%提成,高于10万元的部分,可提成7.5%;
20万到40万之间时,高于20万元的部分,可提成5%;
40万到60万之间时高于40万元的部分,可提成3%;
60万到100万之间时,高于60万元的部分,可提成1.5%,
高于100万元时,超过100万元的部分按1%提成,
从键盘输入当月利润I,求应发放奖金总数?
'''

# in_profit = int(input('净利润:'))
in_profit = 1200000
profit = [1000000, 600000, 400000, 200000, 100000, 0]
rate = [0.01, 0.015, 0.03, 0.05, 0.075, 0.1]
total = 0
for index in range(0, 6):
    if in_profit > profit[index]:
        total = total + (in_profit - profit[index]) * rate[index]
        if index is 0:
            print("大于100万的奖金(1%)     :" + str(total))
        elif index is 1:
            print("加上60-100万的奖金(1.5%):" + str(total))
        elif index is 2:
            print("加上40-60万的奖金(3%)   :" + str(total))
        elif index is 3:
            print("加上20-40万的奖金(5%)   :" + str(total))
        elif index is 4:
            print("加上10-20万的奖金(7.5%) :" + str(total))
        elif index is 5:
            print("加上0-10万的奖金(10%%)   :%s" % str(total))

        in_profit = profit[index]
print("总奖金:")
print(total)


  

 

猜你喜欢

转载自www.cnblogs.com/andy9468/p/9790166.html