Programming Examples
Python program to calculate income tax based on condition
Given below is a hypothetical table showing rate of income tax for an Indian citizen, who is below or up to 60 years.
Taxable Income (TI) in ₹ | Income Tax in ₹ |
Up to ₹ 5,00,000 | Nil |
More than ₹5,00,000 and less than or equal to ₹7,50,000 | (TI-5,00,000)* 10% |
More than ₹7,50,000 and less than or equal to ₹10,00,000 | (TI-7,50,000)* 20% + 30,000 |
More than ₹10,00,000 | (TI-10,00,000) * 30% + 90,000 |
Write a Python code to input the name, age and taxable income of a person. If the age more than 60 years then display a message “Wrong Categoryâ€. IF the age is less than or equal to 60 years then compute and display the payable income tax along with the name of tax payer, as per the table given above.
Solution:
tax=0
name=input("Enter name :")
age=int(input("Enter age:"))
sal=int(input("Enter annual salary:"))
if(age>60):
  print("Wrong Category!")
else:
  if sal<=500000:
    tax=0
  elif sal<=750000:
    tax=(sal-500000)*10/100
  elif sal<=1000000:
    tax=30000+(sal-750000)*20/100
  elif sal>1000000:
    tax=90000+(sal-750000)*30/100
print("Name :",name)
print("Age :",age)
print("Tax Payable =₹",tax)
Output/ Explanation:
Enter name :ravi
Enter age:45
Enter annual salary:650000
Name : ravi
Age : 45
Tax Payable =₹ 15000.0