Compute tax based on the original U.S. income tax of 1913. The tax was 1 percent
ID: 3789153 • Letter: C
Question
Compute tax based on the original U.S. income tax of 1913. The tax was
1 percent on the first $50,000.
2 percent on the amount over $50,000 up to $75,000.
3 percent on the amount over $75,000 up to $100,000.
4 percent on the amount over $100,000 up to $250,000.
5 percent on the amount over $250,000 up to $500,000.
6 percent on the amount over $500,000.
There was no separate schedule for single or married taxpayers. Write a program TaxCalculator.py in python that asks the user for the income and computes the income tax according to this schedule.
Display the income and corresponding tax
Explanation / Answer
from bisect import bisect rates = [1, 2, 3, 4,5,6] brackets = [50000, # first 10,000 75000, # next 20,000 100000,250000,5000000] # next 40,000 base_tax = [1000, 5000, 7500,60000,12500,150000] def tax(income): i = bisect(brackets, income) if not i: return 0 rate = rates[i] bracket = brackets[i-1] income_in_bracket = income - bracket tax_in_bracket = income_in_bracket * rate / 100 total_tax = base_tax[i-1] + tax_in_bracket return total_tax print (total_tax)
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.