个税计算器
根据国家最新税务要求,个税起征点已经提高至5000。
以下是个税计算器代码,但是不会四舍五入,各路大神请指点。
salary = int(input('税前工资是:')) #用户输入税前工资
baoxian = int(input('五险一金是:')) #用户输入保险金额
threshold = 5000 #设定起征点
print('个税起征点为:'+ str(threshold)) #打印个税起征点
taxable_income = int(salary - baoxian - threshold) #应税工资=税前工资-保险-起征点
if taxable_income <0:
print('您的应税工资为:0') #输出应税工资
else:
print('您的应税工资为:' + str(taxable_income)) #输出应税工资
if taxable_income<3000:
tax=taxable_income * 0.03 - 0
print('税率为:3%')
elif taxable_income>=3000 and taxable_income<12000:
tax=taxable_income * 0.1 - 210
print('税率为:10%')
elif taxable_income>=12000 and taxable_income<25000:
tax=taxable_income * 0.2 - 1410
print('税率为:20%')
elif taxable_income>=25000 and taxable_income<35000:
tax=taxable_income * 0.25 - 2660
print('税率为:25%')
elif taxable_income>=35000 and taxable_income<55000:
tax=taxable_income * 0.3 - 4410
print('税率为:30%')
elif taxable_income>=55000 and taxable_income<80000:
tax=taxable_income * 0.35 - 7160
print('税率为:35%')
elif taxable_income>=80000:
tax=taxable_income * 0.45 - 15160
print('税率为:45%')
if taxable_income<0:
taxable_income = 0
if tax<0:
tax = 0
print('您的个税为:' + str(tax)) #输出个税金额
take_home_pay = salary - baoxian - tax #实发工资=税前工资-保险金额-个税
take_home_pay = int(take_home_pay) #将实发工资转换为数值
print('您的实发工资为:' + str(take_home_pay))