# Python Program to Calculate GST

In the previous article, we have discussed Python Program to Find Median of List
Goods and Services Tax (GST):

GST is an abbreviation for Goods and Services Tax. It is a value-added tax levied on goods and services sold for domestic use or consumption. Customers pay GST to the government when they buy goods and services.

To calculate the GST percentage, first, compute the net GST amount by subtracting the original price from the net price that includes the GST. We will use the GST percent formula after calculating the net GST amount.

Formula:

GST% formula =Â ((GST Amount * 100)/Original price)

Net priceÂ  Â  Â  Â  = Original price + GST amount

GST amountÂ  Â = Net price â€“ Original price

GST%Â  Â  Â  Â  Â  Â  Â = ((GST amount * 100)/Original price)

round()Â function: round function rounds off to the nearest integer value.

Given the Net price, the original price, and the task is to calculate the GST percentage.

Examples:

Example1:

Input:

Given original price = 520
Given Net price       = 650

Output:

The GST percent for the above given input net and original prices =  25.0%

Example 2:

Input:

Given original price = 354.80
Given Net price       = 582.5

Output:

The GST percent for the above given input net and original prices =  64.17700112739571%

## Program to Calculate GST

Below are the ways to Calculate GST.

### Method #1: Using Mathematical Formula (Static input)

Approach:

• Give the original price as static input and store it in a variable.
• Give the net price as static input and store it in another variable.
• Calculate the GST amount by using the above-given formula and store it in another variable.
• Calculate the given GST percentage by using the above-given formula and store it in another variable.
• Print the given GST value for the above given original and net prices.
• The Exit of the program.

Below is the implementation:

# Give the original price as static input and store it in a variable.
gvn_Orignl_amt = 520
# Give the net price as static input and store it in another variable.
gvn_Net_amt = 650
# Calculate the GST amount by using the above given formula and store it in
# another variable.
GST_amnt = gvn_Net_amt - gvn_Orignl_amt
# Calculate the given GST percentage by using the above given formula and
# store it in another variable.
gvn_GST_percnt = ((GST_amnt * 100) / gvn_Orignl_amt)
# Print the given GST value for the above given original and net prices.
print("The GST percent for the above given input net and original prices = ",
gvn_GST_percnt, end='')
print("%")


Output:

The GST percent for the above given input net and original prices =  25.0%

### Method #2: Using Mathematical Formula (User input)

Approach:

• Give the original price as user input using float(input()) and store it in a variable.
• Give the net price as user input using float(input()) and store it in another variable.
• Calculate the GST amount by using the above-given formula and store it in another variable.
• Calculate the given GST percentage by using the above-given formula and store it in another variable.
• Print the given GST value for the above given original and net prices.
• The Exit of the program.

Below is the implementation:

# Give the original price as user input using float(input()) and store it in a variable.
gvn_Orignl_amt = float(input("Enter some random number = "))
# Give the net price as user input using float(input()) and store it in another variable.
gvn_Net_amt = float(input("Enter some random number = "))
# Calculate the GST amount by using the above given formula and store it in
# another variable.
GST_amnt = gvn_Net_amt - gvn_Orignl_amt
# Calculate the given GST percentage by using the above given formula and
# store it in another variable.
gvn_GST_percnt = ((GST_amnt * 100) / gvn_Orignl_amt)
# Print the given GST value for the above given original and net prices.
print("The GST percent for the above given input net and original prices = ",
gvn_GST_percnt, end='')
print("%")


Output:

Enter some random number = 354.80
Enter some random number = 582.5
The GST percent for the above given input net and original prices = 64.17700112739571%

Explore more instances related to python concepts fromÂ Python Programming ExamplesÂ Guide and get promoted from beginner to professional programmer level in Python Programming Language.