Python-100-Days/Day01-15/code/Day03/tax.py

40 lines
853 B
Python
Raw Normal View History

2018-03-02 00:09:06 +08:00
"""
输入月收入和五险一金计算个人所得税
2019-05-03 21:17:36 +08:00
说明写这段代码时新的个人所得税计算方式还没有颁布
2018-03-02 00:09:06 +08:00
Version: 0.1
Author: 骆昊
Date: 2018-02-28
"""
salary = float(input('本月收入: '))
insurance = float(input('五险一金: '))
diff = salary - insurance - 3500
if diff <= 0:
2019-05-03 21:17:36 +08:00
rate = 0
deduction = 0
2018-03-02 00:09:06 +08:00
elif diff < 1500:
2019-05-03 21:17:36 +08:00
rate = 0.03
deduction = 0
2018-03-02 00:09:06 +08:00
elif diff < 4500:
2019-05-03 21:17:36 +08:00
rate = 0.1
deduction = 105
2018-03-02 00:09:06 +08:00
elif diff < 9000:
2019-05-03 21:17:36 +08:00
rate = 0.2
deduction = 555
2018-03-02 00:09:06 +08:00
elif diff < 35000:
2019-05-03 21:17:36 +08:00
rate = 0.25
deduction = 1005
2018-03-02 00:09:06 +08:00
elif diff < 55000:
2019-05-03 21:17:36 +08:00
rate = 0.3
deduction = 2755
2018-03-02 00:09:06 +08:00
elif diff < 80000:
2019-05-03 21:17:36 +08:00
rate = 0.35
deduction = 5505
2018-03-02 00:09:06 +08:00
else:
2019-05-03 21:17:36 +08:00
rate = 0.45
deduction = 13505
2018-03-02 00:09:06 +08:00
tax = abs(diff * rate - deduction)
print('个人所得税: ¥%.2f' % tax)
print('实际到手收入: ¥%.2f' % (diff + 3500 - tax))