To calculate tax: GST on a bill and income tax using slabs
Expt. No.07
Page No.14
GST and income tax
Aim
To write a Python program that calculates GST on a bill amount, and income tax using a sample set of slabs (up to 4,00,000 nil; next 4,00,000 at 5%; next 4,00,000 at 10%; the rest at 15%).
Concepts used
Algorithm
- Input the bill amount and the GST rate; GST = amount × rate ÷ 100; display the bill with GST.
- Input the yearly income.
- Work out the tax slab by slab: nothing on the first 4 lakh, 5% on the next 4 lakh, 10% on the next 4 lakh and 15% on the rest.
- Display the income tax.
Program
# GST on a bill, and income tax using sample slabs amount = float(input("Bill amount : "))gst_rate = float(input("GST rate (%) : "))gst = amount * gst_rate / 100print("GST :", gst)print("Total bill :", amount + gst) income = float(input("Yearly income: "))if income <= 400000: tax = 0elif income <= 800000: tax = (income - 400000) * 5 / 100elif income <= 1200000: tax = 20000 + (income - 800000) * 10 / 100else: tax = 60000 + (income - 1200000) * 15 / 100print("Income tax :", tax)
A marked line continues the line above it. In your file, write it on the same line.
Output
$ python gst_and_income_tax.py
Bill amount : 1500
GST rate (%) : 18
GST : 270.0
Total bill : 1770.0
Yearly income: 1000000
Income tax : 40000.0
✓ Printed by running this program, not typed by hand.
Result
GST at 18% on a bill of 1500 was 270.0, making the total 1770.0. On an income of 10,00,000 the tax was 40000.0: 20000 on the 4–8 lakh slab plus 10% of the 2 lakh above 8 lakh.
Viva voce: what the examiner may ask
01Why is 20000 added in the third slab?
It is the full tax of the previous slab: 5% of 4,00,000.
02Are these the official income tax slabs?
No. They are sample slabs for practice; the real slabs change with each budget.
03How is the total bill found?
Bill amount + GST.
Variations for the lab test
- Split the GST equally into CGST and SGST.
- Add a 4% cess on the income tax.
- Input the GST rate as one of 5, 12, 18 or 28 and reject other values.
! Common mistake Applying 10% to the whole income in the third slab (
income * 10 / 100) ignores the lower slabs and gives too much tax.