How to Calculate Salary of Employee with Taxable Amount in Python

This is a simple program to calculate salary of employee with taxable amount in Python. The program requires the name of the employee, name of the company, salary of the employee. It will then calculate based on 20% tax rate. If the employee’s salary falls below 10,000, then the employee is not taxed. Else the employee is taxed with 20% deduction.
  1. emp_name = input("Enter the name of the Employee: \n")
  2. comp_name = input("Enter the company name: \n")
  3. salary = float(input("Enter the salary of the Employee: \n"))
  4.  
  5. if (salary > 10000):
  6. tax = 0.20 * salary
  7. net_salary = salary - tax
  8.  
  9. print("The net salary of " + emp_name+" in " + comp_name + " is", net_salary)
  10. else:
  11. net_salary = salary
  12.  
  13. print("Salary is not Taxable")
  14. print("The Net salary of " + emp_name + " in " + comp_name + " is ", salary)

Add new comment