题目:企业发放的奖金根据利润提成。利润 (I) : 低于或等于 10 万元时,奖金可提 10% ; 高于 10 万元,低于 20 万元时,低于 10 万元的部分按 10% 提成,高于 10 万元的部分

本文介绍了一个使用Python实现的奖金计算程序,根据不同利润等级,计算并输出相应的奖金数额。该程序通过一系列条件判断,精确地计算出不同利润区间的奖金比例。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

python代码块:

    def test(profile):
        #    while True:
                if profile>0 and profile<=100000:
                    bonus = profile*0.01
                    print(bonus)
                elif profile>100000 and profile<=200000:
                    bonus = 100000*0.1 + (profile-100000)*0.075
                    print(bonus)
                elif profile>200000 and profile<=400000:
                    bonus = 100000*0.1 + 100000*0.075 + (profile-200000)*0.05
                    print(bonus)
                elif profile>400000 and profile<=600000:
                    bonus = 100000*0.1 + 100000*0.075 + 200000*0.05 + (profile-400000)*0.03
                    print(bonus)
                elif profile>600000 and profile<=1000000:
                    bonus = 100000*0.1 + 100000*0.075 + 200000*0.05 + 200000*0.03 + (profile-600000)*0.015
                    print(bonus)
                elif profile>1000000:
                    bonus = 100000*0.1 + 100000*0.075 + 200000*0.05 + 200000*0.03 + 400000*0.015 + (profile-600000)*0.01
                    print(bonus)
        #        elif profile == 0:
        #            break
        
        def main():
            profile = 1
            while profile != 0:
                profile = int(input('请输入利润/元'))
                test(profile)
        
        main()
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值