dimanche 14 février 2021

I am using if/else statements to calculate salary and am receiving this error: TypeError: '<=' not supported between instances of 'str' and 'float'

I am trying to calculate bi-weekly salary, calculating the tax rate as salary increases. When I use if/else statements to change the tax rate on different salaries, it gives me an error.

salary = (input('Enter salary: '))
marital_status = input('Enter marital status M for married or S for other: ')

if marital_status is 'S':
    if salary <= 10000.00:
        print(salary * .05)
    else salary <= 50000.00:
        print(500.00 + (salary * .105)
    else salary > 50000.00
        print(4700.00 + (salary * .2025)

Aucun commentaire:

Enregistrer un commentaire