CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
jackfrued

CoCalc provides the best real-time collaborative environment for Jupyter Notebooks, LaTeX documents, and SageMath, scalable from individual users to large groups and classes!

GitHub Repository: jackfrued/Python-100-Days
Path: blob/master/Day01-15/code/Day03/tax.py
Views: 729
1
"""
2
输入月收入和五险一金计算个人所得税
3
说明:写这段代码时新的个人所得税计算方式还没有颁布
4
5
Version: 0.1
6
Author: 骆昊
7
Date: 2018-02-28
8
"""
9
10
salary = float(input('本月收入: '))
11
insurance = float(input('五险一金: '))
12
diff = salary - insurance - 3500
13
if diff <= 0:
14
rate = 0
15
deduction = 0
16
elif diff < 1500:
17
rate = 0.03
18
deduction = 0
19
elif diff < 4500:
20
rate = 0.1
21
deduction = 105
22
elif diff < 9000:
23
rate = 0.2
24
deduction = 555
25
elif diff < 35000:
26
rate = 0.25
27
deduction = 1005
28
elif diff < 55000:
29
rate = 0.3
30
deduction = 2755
31
elif diff < 80000:
32
rate = 0.35
33
deduction = 5505
34
else:
35
rate = 0.45
36
deduction = 13505
37
tax = abs(diff * rate - deduction)
38
print('个人所得税: ¥%.2f元' % tax)
39
print('实际到手收入: ¥%.2f元' % (diff + 3500 - tax))
40
41