-3

i am beginer of the python programming. i am creating simple employee salary calculation using python. tax = salary * 10 / 100 this line said wrong error displayed Unindent does not match outer indentation level

this is the full code

   salary = 60000

if(salary > 50000):
    tax = float(salary * 10 / 100)
elif(salary > 35000):
    tax =  float(salary * 5 / 100)
else:
    tax = 0

    netsal = salary - tax
    print(tax)
    print(netsal)
kobi udemy
  • 35
  • 5

2 Answers2

3

The error message is self explanatory.

You can't indent your elif and else, they should be at the same level as the if condition.

salary = 60000

if(salary > 50000):

    tax =   salary * 10 / 100

elif(salary > 35000):

    tax = salary * 5 / 100

else :

    tax = 0

netsal = salary - tax
print(tax)
print(netsal)
Mathis Germa
  • 103
  • 1
  • 7
1

You just need to fix your indentation, I would suggest using an IDE

salary = 60000

if(salary > 50000):
    tax = salary * 10 / 100
elif(salary > 35000):
    tax = salary * 5 / 100
else:
    tax = 0

print(tax)
>>> 6000.0
7koFnMiP
  • 472
  • 3
  • 17