[Tutor] Tax Brand

Thabile Rampa thabilerampa at gmail.com
Tue Oct 8 22:38:02 CEST 2013


Hello,

So my task is to get information from a user about their salary and then
find their net salary and tax
deductions. I have seemingly worked everything fine until the part where I
am supposed to tell them what tax Band they are in (i.e 1,2,3 or 4).
My code is like this:



taxBAND = None
GrossSalary = None
costs = None
taxdeducted =None
netSalary = None
line ="-"*80
name =""




while not name:
     name =raw_input("ENTER NAME HERE: ")
while not costs:
    costs =float(raw_input("enter costs here: "))
while not GrossSalary:
    GrossSalary= int(raw_input("enter your gross salary: "))

if (GrossSalary < 50000):
    taxdeducted= 0.05*(GrossSalary -costs)
    netSalary = GrossSalary - taxdeducted
    while GrossSalary < 50000:
         print taxBAND == 1

elif (GrossSalary >= 50000 and GrossSalary < 150000):
     taxdeducted = 0.1*(GrossSalary - costs)
     netSalary = GrossSalary - taxdeducted

print line
print "\t\t BURS STATEMENT: ",name
print line
print "Gross", "\t Costs", "\t Tax BAND", "\tTax Deducted", "\t Net Salary"
print
GrossSalary,"\t",costs,"\t\b",taxBAND,"\t",taxdeducted,"\t\t",netSalary
print line



I haven't put in the whole code because it's too long. I instead want to
focus on the problem which can be found in the if section: print taxBAND ==
1

I have tried all the different operators, from augmentation to logical to
comparison, but I still get errrors. The errors I have acquired so far are:

1.
Traceback (most recent call last):
File "X:/xxx/Xxxx.py", line 30, in <module>
taxBAND += 1
TypeError: unsupported operand type (s) for +=: 'NoneType' and 'int'

2.
Traceback (most recent call last):
File "X:/xxx/Xxxx.py", line 30, in <module>
taxBAND = I
NameError: Name 'I' is not defined

(the first two errors were before i added the line "while GrossSalary <
50000:")

3.
Traceback (most recent call last):
File "X:/xxx/Xxxx.py", line 31, in <module>
taxBAND += 1
TypeError: unsupported operand type (s) for +=: 'NoneType' and 'int'

4.
Traceback (most recent call last):
File "X:/xxx/Xxxx.py", line 31, in <module>
taxBAND = I
NameError: Name 'I' is not defined

Regards,
Tab
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20131008/fbce836a/attachment-0001.html>


More information about the Tutor mailing list