while True:
try:
profit = int(input('请输入利润>'))
except ValueError:
print('您的输入有误,请重新输入')
else:
break
deduct, pro_num = 0, 0
while True:
if profit <= 100000 or pro_num in [1, 2, 3, 4, 5]:
if pro_num in [1, 2, 3, 4, 5]:
deduct += 100000 * 0.1
if pro_num == 1:
break
else:
deduct = profit * 0.1
break
if 100000 < profit <= 200000 or pro_num in [2, 3, 4, 5]:
if pro_num in [2, 3, 4, 5]:
deduct += 100000 * 0.075
if pro_num == 2:
break
else:
pro_num = 1
profit -= 100000
deduct = profit * 0.075
if 200000 < profit <= 400000 or pro_num in [3, 4, 5]:
if pro_num in [3, 4, 5]:
deduct += 200000 * 0.05
if pro_num == 3:
break
else:
pro_num = 2
profit -= 200000
deduct = profit * 0.05
if 400000 < profit <= 600000 or pro_num in [4, 5]:
if pro_num in [4, 5]:
deduct += 200000 * 0.03
if pro_num == 4:
break
else:
pro_num = 3
profit -= 400000
deduct = profit * 0.03
if 600000 < profit <= 1000000 or pro_num in [5]:
if pro_num in [5]:
deduct += 400000 * 0.03
if pro_num == 5:
break
else:
pro_num = 4
profit -= 600000
deduct = profit * 0.015
if profit > 1000000:
pro_num = 5
profit -= 1000000
deduct = profit * 0.01
print('最终提成为>', deduct)
感觉应该没有人写的比我还复杂了吧 |