欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

用python写一个北京市的个税计算器

程序员文章站 2022-04-19 23:19:17
执行结果演示: ......
 1 #应纳税的钱:税前收入-5000元(起征点)-专项扣除(五险一金等)
 2 #工资个税的计算公式为:
 3 #个人所得税=应纳税的钱×适用税率-速算扣除数
 4 '''
 5 1、全月应纳税所得额不超过3000元:
 6 税率:3%; 速算扣除数(元):0
 7 2、全月应纳税所得额超过3000元至12000元:
 8 税率:10%; 速算扣除数(元):210
 9 3、全月应纳税所得额超过12000元至25000元:
10 税率:20%; 速算扣除数(元):1410
11 4、全月应纳税所得额超过25000元至35000元:
12 税率:25%; 速算扣除数(元):2660
13 5、全月应纳税所得额超过35000元至55000元:
14 税率:30%; 速算扣除数(元):4410
15 6、全月应纳税所得额超过55000元至80000元:
16 税率:35%; 速算扣除数(元):7160
17 7、全月应纳税所得额超过80000元:
18 税率:45%; 速算扣除数(元):15160
19 '''
20 #定义税前工资
21 tax_salary = int(input("请输入你的工资:"))
22 if tax_salary > 5000:
23     #应纳税的工资
24     taxable_salary = tax_salary - 5000 - tax_salary * 0.22
25 
26     if taxable_salary <= 3000:
27         # 个人所得税
28         personal_income_taxes = taxable_salary * 0.03 - 0
29 
30     elif taxable_salary > 3000 and taxable_salary <= 12000:
31         personal_income_taxes = taxable_salary * 0.1 - 210
32 
33     elif taxable_salary > 12000 and taxable_salary <= 25000:
34         personal_income_taxes = taxable_salary * 0.2 - 1410
35 
36     elif taxable_salary > 25000 and taxable_salary <= 35000:
37         personal_income_taxes = taxable_salary * 0.25 - 2660
38 
39     elif taxable_salary > 35000 and taxable_salary <= 55000:
40         personal_income_taxes = taxable_salary * 0.3 - 4410
41 
42     elif taxable_salary > 55000 and taxable_salary <= 80000:
43         personal_income_taxes = taxable_salary * 0.35 - 7160
44 
45     elif taxable_salary > 80000:
46         personal_income_taxes = taxable_salary * 0.45 - 15160
47     #五险一金
48     five_one_gold = tax_salary * 0.22
49     #实发工资
50     net_pay = tax_salary - personal_income_taxes - five_one_gold
51 
52     print("本月实发工资(税后)为:{}".format(net_pay))
53 else:
54     print("本月实发工资(税后)为:{}".format(tax_salary))

执行结果演示:

用python写一个北京市的个税计算器

用python写一个北京市的个税计算器