To Create GST calculator using Python

GST:GST stands for Goods and services Tax.it is a value-added tax on the goods and services which are sold for domenstic purpose or consumption.

The GST is paid by the customers to the government on purchasing goods and services .

for EXAMPLE:

  • Original price = Rs.1000,Net price = Rs 1180,GST% = 18%

Original price = Rs 2500, Net price = Rs 3000,GST% = 20%

HOW TO CALCULATE GST:

To calculate the GST% first, we need to calculate the net GST amount by substracting the original price from the Net price in which the GST is included.After calculating the net GST amount,we will apply the GST% formula which is given below:

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)

PROGRAM CODE TO CALCULATE THE GST:

def calculate_gst(price, gst_rate):
    """
    Calculate the GST and total price including GST.
    
    Parameters:
    price (float): The original price of the product or service.
    gst_rate (float): The GST rate as a percentage.
    
    Returns:
    tuple: A tuple containing the GST amount and the total price including GST.
    """
    gst_amount = (price * gst_rate) / 100
    total_price = price + gst_amount
    return gst_amount, total_price


original_price = 1000.0  
gst_rate = 18.0  

gst_amount, total_price = calculate_gst(original_price, gst_rate)
print(f"Original Price: {original_price}")
print(f"GST Rate: {gst_rate}%")
print(f"GST Amount: {gst_amount}")
print(f"Total Price (including GST): {total_price}")

output:

Original Price: 1000.0
GST Rate: 18.0%
GST Amount: 180.0
Total Price (including GST): 1180.0

 

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top