Feb-07-2020, 07:30 PM
I want to calculate the amount of state tax withheld from a paycheck using a calculator coded with python below is the code i have wrote thus far:
if (Allowances == "0") :
StateLocalTax = 0.04206
elif (Allowances == "1") :
StateLocalTax = 0.00074
elif (Allowances == "2") :
StateLocalTax = 0.00079
elif (Allowances == "3") :
StateLocalTax = 0.00064
elif (Allowances == "4") :
StateLocal = 0.00056
elif (Allowances == "5") :
StateLocalTax = 0.00052
elif (Allowances == "6") :
StateLocalTax = 0.00048
elif (Allowances == "7") :
StateLocalTax = 0.00000
elif (Allowances == "8") :
StateLocalTax = 0.00000
elif (Allowances == "9") :
StateLocalTax = 0.00000
elif (Allowances == "10") :
StateLocalTax = 0.00000
StateLocal = float(GrossPay) * float(StateLocalTax)
Traceback (most recent call last):
File "C:/Users/19898/Desktop/Pay.py", line 35, in <module>
StateLocal = float(GrossPay) * float(StateLocalTax)
NameError: name 'StateLocalTax' is not defined
When I run the program it states that StateLocalTax is not defined. What am I missing?
if (Allowances == "0") :
StateLocalTax = 0.04206
elif (Allowances == "1") :
StateLocalTax = 0.00074
elif (Allowances == "2") :
StateLocalTax = 0.00079
elif (Allowances == "3") :
StateLocalTax = 0.00064
elif (Allowances == "4") :
StateLocal = 0.00056
elif (Allowances == "5") :
StateLocalTax = 0.00052
elif (Allowances == "6") :
StateLocalTax = 0.00048
elif (Allowances == "7") :
StateLocalTax = 0.00000
elif (Allowances == "8") :
StateLocalTax = 0.00000
elif (Allowances == "9") :
StateLocalTax = 0.00000
elif (Allowances == "10") :
StateLocalTax = 0.00000
StateLocal = float(GrossPay) * float(StateLocalTax)
Traceback (most recent call last):
File "C:/Users/19898/Desktop/Pay.py", line 35, in <module>
StateLocal = float(GrossPay) * float(StateLocalTax)
NameError: name 'StateLocalTax' is not defined
When I run the program it states that StateLocalTax is not defined. What am I missing?