So the basics of this, is that I am attempting to have a user input their yearly salary, then the program will run it through a set of if statements then return what tax bracket they are in, subtract the amount from their yearly salary and return what their gross income will be. The main problem is that it will run correctly for any amounts of $0 - $9,525 but once you jump up to the 12% and 22% it does not make it their. Like if you were to enter $100,000 it would just deduct 12% out of it when it should deduct 24%. Here is the Python code in its current form:
#Takes someone's yearly salary
yearlySalary = eval(input("Please enter your yearly salary: "))
if(yearlySalary < 9525):
tax = yearlySalary * .10
yearlySalary = yearlySalary-tax
elif(yearlySalary > 9526 && yearlySalary < 38700):
tax = yearlySalary * .12
yearlySalary = yearlySalary-tax
elif(range (38701, 82500)):
tax = yearlySalary * .22
yearlySalary = yearlySalary-tax
elif(range (82501, 157500)):
tax = yearlySalary * .24
yearlySalary = yearlySalary-tax
elif(range(157501, 200000)):
tax = yearlySalary * .32
yearlySalary = yearlySalary-tax
elif(range(200001, 500000)):
tax = yearlySalary * .35
yearlySalary = yearlySalary-tax
elif(yearlySalary > 500001):
tax = yearlySalary * .37
yearlySalary = yearlySalary-tax