Below is the Python code that follows the specifications provided.
def calc_AGI(wages, interest, unemployment):
# Convert negative values to positive
wages = abs(wages)
interest = abs(interest)
unemployment = abs(unemployment)
# Calculate AGI
agi = wages + interest + unemployment
return agi
def get_deduction(status):
# Deduction based on status
if status == 0: # dependent
return 6000
elif status == 1: # single
return 12000
elif status == 2: # married
return 24000
else:
return 6000 # default deduction for invalid status
def calc_taxable(agi, deduction):
# Calculate taxable income
taxable = max(0, agi - deduction)
return taxable