Pythondex
Python Programs

Python Program To Calculate GST

Last updated June 21, 2023 by Jarvis Silva

in this tutorial I will show you how to create python program to calculate GST, it is a goods and service tax it is applicable in India it is paid by the customers to the government so inorder to make gst calculation easy I have decided to created this tutorial to calculate how much GST you are paying.

Python Code For GST Calculator


selling_price = int(input("Enter selling price of the product: "))
gst_rate = 18
gst_price = selling_price * 18 / 100
net_price = selling_price + gst_price
print(f"GST applied rs: {gst_price} at GST rate {gst_rate}%")
print(f"Total cost of the product after applying GST = {net_price}")

Above is the code for calculating GST, in the code we perform some calculations let’s see how this code works:

  • The user is prompted to enter the selling price of a product.
  • The code assumes a GST (Goods and Services Tax) rate of 18%.
  • The GST price is calculated by multiplying the selling price by 18% (or 0.18).
  • The net price is calculated by adding the selling price and the GST price.
  • The code then prints the GST applied, displaying the amount in rupees and the GST rate of 18%.
  • Finally, the code prints the total cost of the product after applying the GST, which is the net price.

You can test this program to run it you need to have python installed on your computer, If you don’t have then follow this guide: Install and setup python on your computer or use this online python compiler.

After running this program you will see that it will ask you to enter the selling price of the product then it will print the GST applied amount and net price price of the product below is an example output.


Enter selling price of the product: 1000
GST applied rs: 180.0 at GST rate 18%
Total cost of the product after applying GST = 1180.0

As you can see we successfully created a gst calculator program, I hope you found this tutorial helpful and useful, do share this tutorial with your friends who might want help in gst calculation.

Here are some more python program tutorials for you:

I hope you found what you were looking for from this tutorial, and if you want more python programs and tutorials like this, do join our Telegram channel for future updates.

Thanks for reading, have a nice day 🙂