Question: PYTHON CODE Please post code pic and output if you find my error: For example, from the taxable income of $400,000 for a single filer,
PYTHON CODE
Please post code pic and output if you find my error:

For example, from the taxable income of $400,000 for a single filer, $8,350 is taxed at 10%, (33,950 8,350) at 15%, (82,250 33,950) at 25%, (171,550 82,250) at 28%, (372,950 171,550) at 33%, and (400,000 372,950) at 35%. The six rates are the same for all filing statuses, which can be represented in the following list:
rates = [0.10, 0.15, 0.25, 0.28, 0.33, 0.35]
The brackets for each rate for all the filing statuses can be represented in a two dimensional list as follows:


NEED HELP WITH THE TAX CALCULATION
def calculateTax(limitArray, income): limitArray.append(income) rates = [0.10, 0.15, 0.25, 0.28, 0.33, 0.35] tax = 0 for i in range(1,len(rates) + 1): if income > limitArray[i]: tax = tax + (limitArray[i] - limitArray[i - 1]) * rates[i - 1] else: tax = tax + (income - limitArray[i - 1]) * rates[i - 1] break return tax
limitsSingle = [0, 8350, 33950, 82250, 171550, 372950] limitsJoint = [0, 16700, 67900, 137050, 208850, 372950] limitsSeparate = [0, 8350, 33950, 68525, 104425, 186475] limitsHead = [0, 11950, 45500, 117450, 190200, 372950]
taxableIncome = input('Enter the taxable income: ') category = input('Enter 1 for Single, 2 for Married Jointly, 3 for Married Separately, 4 for Head of Household: ')
if category == '1': tax = calculateTax(limitsSingle, int(taxableIncome))
if category == '2': tax = calculateTax(limitsJoint, int(taxableIncome))
if category == '3': tax = calculateTax(limitsSeparate, int(taxableIncome))
if category == '4': tax = calculateTax(limitsHead, int(taxableIncome))
else: print('Invalid') tax =0
print('The tax is: ' + str(tax))
Marginal Single Married Filing Jointly Married Filing Separately Head of Household Tax Rate $0-$8,350 $0-$16,700 $0-$8,350 S0 -$11,950 10% $11,951-$45,500 $8,351-$33,950 $16,701 $67,900 $8,351-$33,950 15% s33,951-$68,525 $33,951 $82,250 $67,901 $137,050 $45,501 $117,450 25% 28% $82,251 -$171,550 $137,051 $208,850 $68,526 $104,425 $117,451 -$190,200 33% $171,551 $372,950 $208,851-$372,950 $104,426-$186,475 $190,201 -$372,950 $372,951+ $372,951+. 35% $186,476+ S372,951+
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
