0% found this document useful (0 votes)
478 views1 page

GST Billing System

This is the GST billing program

Uploaded by

hero78590
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
478 views1 page

GST Billing System

This is the GST billing program

Uploaded by

hero78590
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

# GST Billing System in Python

---------------------------------
def calculate_gst(price, gst_rate):
"""Calculate GST and return GST amount and total price including GST."""
gst_amount = (price * gst_rate) / 100
total_price = price + gst_amount
return gst_amount, total_price

def generate_bill(items):
"""Generate and display the bill."""
print("\n--------- GST BILL ---------")
print("{:<20} {:<10} {:<10} {:<10}".format("Item", "Price", "GST(%)", "Total"))
print("-" * 50)

total_cost = 0
total_gst = 0

for item in items:


name, price, gst_rate = item['name'], item['price'], item['gst_rate']
gst_amount, total_price = calculate_gst(price, gst_rate)
total_cost += total_price
total_gst += gst_amount
print("{:<20} {:<10} {:<10} {:<10.2f}".format(name, price, gst_rate,
total_price))

print("-" * 50)
print(f"Total GST Amount: {total_gst:.2f}")
print(f"Total Amount (incl. GST): {total_cost:.2f}")
print("-" * 50)

def main():
print("Welcome to the GST Billing System")
items = []

while True:
name = input("Enter item name: ")
price = float(input("Enter item price: "))
gst_rate = float(input("Enter GST rate (%): "))

items.append({"name": name, "price": price, "gst_rate": gst_rate})

more = input("Do you want to add another item? (yes/no): ").strip().lower()


if more != 'yes':
break

generate_bill(items)

if __name__ == "__main__":
main()

You might also like