Based on excel sheet from this npr article
{total_income_int: Total Income ? Enter the total amount of your annual take-home income (i.e. money that you get as a paycheck)}
{health_insurance_plan_int: Health Insurance Plan ? Enter the amount of your health insurance plan if your institution gives you one as part of your appointment.}
{tuition_int: Tuition ? Enter the amount of tuition you have had waived}
{fellowship_int: Fellowship? ? no = 0}
# Crosscompute
total_income_int = 35000
health_insurance_plan_int = 4304
tuition_int = 17500
fellowship_int = 0
target_folder = '.'
fellowship = 1 if fellowship_int != 0 else 0
def get_taxable_income(income, std_deduction, personal_exemption):
return income - std_deduction - personal_exemption
# current law
taxable_income = get_taxable_income(total_income_int, 6350, 4050)
taxable_income
if taxable_income >= 0 and taxable_income <= 9325:
curr_tax = .1 * taxable_income
elif taxable_income > 9325 and taxable_income <= 37950:
curr_tax = 932.5 + (0.15 * (taxable_income - 9325))
elif taxable_income > 37950 and taxable_income <= 91900:
curr_tax = 5526.25 + (0.25 * (taxable_income - 37950))
text = ['current taxable income = %d' % taxable_income]
text.append('current tax = %d' % curr_tax)
# tax cuts and jobs act
income = total_income_int + health_insurance_plan_int + (tuition_int * (1 - fellowship))
new_taxable_income = get_taxable_income(income, 12200, 0)
new_taxable_income
if new_taxable_income >= 0 and new_taxable_income <= 45000:
new_tax = .12 * new_taxable_income
elif new_taxable_income > 45000 and new_taxable_income <= 200000:
new_tax = 5400 + (0.25 * (new_taxable_income - 45000))
text.append('new taxable income = %d' % new_taxable_income)
text.append('new tax = %d' % new_tax)
tax_incr = new_tax - curr_tax
percent_incr = (tax_incr / curr_tax) * 100
percent_incr
text.append('tax increase (dollars) = $%d' % tax_incr)
text.append('tax increase (percentage) = %.2f%%' % percent_incr)
from os.path import join
path = join(target_folder, 'results.txt')
with open(path, 'w') as f:
f.writelines([x + '\n' for x in text])
print('results_text_path = %s' % path)