# Python系列之四——在北京当房奴的日子~

1.等额本息

2.五险一金

3.税前税后工资

4.应缴税额

5.个税缴纳额

6.速算扣除数

1.先算下30年你一共还多少，每个月月供多少~

`每月还款额=[贷款本金×月利率×（1+月利率）^还款月数]÷[（1+月利率）^还款月数－1]`

```#encoding=utf-8
loans = 280  #贷款金额
rate_year = 0.0325  # 年利率
months = 360  #贷款时长（以月为单位）
rate_month = rate_year / 12  #月利率
fenmu = pow(1+rate_month,months) -1  #分母
fenzi = loans * rate_month * pow(1+rate_month,months)  #分子
pay = fenzi/fenmu
print('repayment per month:',pay)
#print(rate_month)
#print(fenmu)
#print(fenzi)```

`>>> repayment per month: 1.218577693402671`

2. 再算一算我们可怜的工资

```#encoding=utf-8
wage_before = 18000  #税前工资
tax_need = wage_before - wage_before*0.2 - 3500 #个人应纳税额
#阶梯税
if tax_need <= 1500:
tax = tax_need * 0.03
elif tax_need <= 4500:
tax = tax_need * 0.1 - 105
elif tax_need <= 9000:
tax = tax_need * 0.2 - 555
elif tax_need <= 35000:
tax = tax_need * 0.25 - 1005
elif tax_need <= 55000:
tax = tax_need * 0.3 - 2755
elif tax_need <= 80000:
tax = tax_need * 0.35 - 5505
elif tax_need > 80000:
tax = tax_need * 0.45 - 13505
#税后工资
wage_after = wage_before * 0.8 - tax

`>>> your salary after tax is: 12680.0`

296 篇文章45 人订阅

0 条评论

29860

17440

12320

30030

32870

28040

35180

10720

9320

432100