鱼C论坛

 找回密码
 立即注册
查看: 23877|回复: 136

[技术交流] Python:每日一题 2

  [复制链接]
发表于 2020-3-1 17:16:31 | 显示全部楼层
profitx = float(input('请输入企业利润:'))

if profitx <= 100000:
    bonus0 = profitx * 0.1
    bonus = bonus0
elif profitx <= 200000 and profitx > 100000:
    bonus0 = 100000 * 0.1
    bonus1 = (profitx - 100000) * 0.075
    bonus = bonus0 + bonus1
elif profitx <= 400000 and profitx > 200000:
    bonus0 = 100000 * 0.1
    bonus1 = 100000 * 0.075
    bonus2 = (profitx - 2000000) * 0.005
    bonus = bonus0 + bonus1 + bonus2
elif profitx <=600000 and profitx >400000:
    bonus0 = 100000 * 0.1
    bonus1 = 100000 * 0.075
    bonus2 = 2000000 * 0.005
    bonus3 = (profitx - 4000000) * 0.003
    bonus = bonus0 + bonus1 + bonus2 + bonus3
elif profitx <=1000000 and profitx > 600000:
    bonus0 = 100000 * 0.1
    bonus1 = 100000 * 0.075
    bonus2 = 2000000 * 0.005
    bonus3 = 2000000 * 0.003
    bonus4 = (profitx - 6000000) * 0.00015
    bonus = bonus0 + bonus1 + bonus2 + bonus3 + bonus4
elif profitx > 1000000:
    bonus0 = 100000 * 0.1
    bonus1 = 100000 * 0.075
    bonus2 = 2000000 * 0.005
    bonus3 = 2000000 * 0.003
    bonus4 = 4000000 * 0.00015
    bonus5 = (profitx -600000) * 0.0001
    bonus = bonus0 + bonus1 + bonus2 + bonus3 + bonus4 +bonus5

print('奖金总数为:%.2f' % bonus)
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2025-9-27 10:57

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表