其他分享
首页 > 其他分享> > 例子二

例子二

作者:互联网

请利用数轴来分界,定位。注意定义时需把奖金定义成长整型。
View Code
bonus1 = 100000 * 0.1
bonus2 = bonus1 + 100000 * 0.500075
bonus4 = bonus2 + 200000 * 0.5
bonus6 = bonus4 + 200000 * 0.3
bonus10 = bonus6 + 400000 * 0.15

i = int(raw_input('input gain:\n'))
if i <= 100000:
    bonus = i * 0.1
elif i <= 200000:
    bonus = bonus1 + (i - 100000) * 0.075
elif i <= 400000:
    bonus = bonus2 + (i - 200000) * 0.05
elif i <= 600000:
    bonus = bonus4 + (i - 400000) * 0.03
elif i <= 1000000:
    bonus = bonus6 + (i - 600000) * 0.015
else:
    bonus = bonus10 + (i - 1000000) * 0.01
print 'bonus = ',bonus
View Code

 

标签:10,提成,高于,60,例子,万元,20
来源: https://www.cnblogs.com/jiaqili/p/14270710.html