0% found this document useful (0 votes)
11 views2 pages

Python Mini Grocery Store Billing System

The Mini Grocery Store Billing System is a Python project that allows users to input items and their prices, add them to a shopping cart, and calculate the total bill including GST and discounts. It features user interaction for item selection and quantity input, with conditional logic for discount application. The program outputs a detailed bill summarizing the subtotal, GST, and final amount to pay.

Uploaded by

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

Python Mini Grocery Store Billing System

The Mini Grocery Store Billing System is a Python project that allows users to input items and their prices, add them to a shopping cart, and calculate the total bill including GST and discounts. It features user interaction for item selection and quantity input, with conditional logic for discount application. The program outputs a detailed bill summarizing the subtotal, GST, and final amount to pay.

Uploaded by

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

Mini Grocery Store Billing System (Python Project)

Project Code:

# Get number of items to add to store


num_items = int(input("Enter the number of items in your store: "))

# Create empty lists


item_names = []
item_prices = []

# Input store items


for i in range(num_items):
name = input(f"Enter name of item {i+1}: ")
price = float(input(f"Enter price of {name}: "))
item_names.append(name)
item_prices.append(price)

# Convert item list to tuple (to meet requirement)


item_names = tuple(item_names)

# Initialize cart
cart = []
quantities = []

# Display items
print("\n--- Welcome to Mini Grocery Store ---")
print("Items Available:")
for i in range(len(item_names)):
print(f"{i+1}. {item_names[i]} - Rs.{item_prices[i]}")

# Shopping loop
while True:
choice = int(input("\nEnter item number to buy (0 to finish): "))

if choice == 0:
break
elif 1 <= choice <= len(item_names):
qty = int(input(f"Enter quantity of {item_names[choice - 1]}: "))
[Link](choice - 1)
[Link](qty)
else:
print("Invalid item number!")

# Calculate total
print("\nGenerating Bill...\n")
subtotal = 0
for i in range(len(cart)):
idx = cart[i]
qty = quantities[i]
item_total = item_prices[idx] * qty
subtotal += item_total
print(f"{item_names[idx]} x {qty} = Rs.{item_total:.2f}")

# Apply GST (18%)


gst = subtotal * 0.18
grand_total = subtotal + gst

# Discount condition
if grand_total > 500:
discount = grand_total * 0.1
grand_total -= discount
print(f"\nDiscount Applied (10%): Rs.{discount:.2f}")

# Final Output
print(f"\nSubtotal: Rs.{subtotal:.2f}")
print(f"GST (18%): Rs.{gst:.2f}")
print(f"Total Amount to Pay: Rs.{grand_total:.2f}")
print("\nThank you for shopping with us!")

Project Features Recap:

- User inputs custom items and prices


- Items are added to cart using list
- Total, GST, and discount calculated using conditional statements
- Tuple used to store item names

Common questions

Powered by AI

The discount condition is triggered if the grand total, including GST, exceeds Rs. 500. Once activated, a 10% discount is applied to reduce the grand total, thus lowering the customer's final cost. This mechanism encourages higher spending by offering savings, which can drive sales and increase customer satisfaction .

Displaying items with formatted prices contributes positively to user perception by enhancing clarity and professionalism of the interface. It helps users easily comprehend the cost of individual items, which is essential for informed purchase decisions and minimizes errors during the checkout process, leading to a smoother billing experience .

Using a while loop for managing item selection may lead to an indefinite loop if termination conditions are not met properly, such as a failure to enter '0' to finish transactions. Additionally, it requires users to have a clear understanding of how to exit the loop, which can be challenging for novice users, potentially leading to confusion or frustration if inputs are not handled correctly .

Calculating the total bill as a distinct step aids performance by clearly demarcating cost evaluation from item selection, enhancing readability and reducing complexity during the checkout process. However, it could also introduce latency if there are numerous items or substantial purchases due to sequential processing demands. Optimizing this step could involve parallel processing techniques or optimized algorithms to handle larger datasets more efficiently .

The system calculates GST by multiplying the subtotal of all purchased items by the GST rate of 18%. This value is then added to the subtotal to derive the grand total before any discounts. The implication of applying GST is that it increases the total amount payable by the customer, representing the typical tax burden found in real-world transactions .

The system mirrors real-world grocery billing operations through features like item selection, quantity input, and tax calculation. However, enhanced realism could be achieved by incorporating features such as barcode scanning, inventory management, and dynamic pricing updates. These additions would simulate a broader range of real-world interactions and improve operational effectiveness .

The system allows users to input custom items and their respective prices by requesting the number of items first and then iteratively asking for each item's name and price. This feature is significant because it provides flexibility and personalization, allowing users to adapt the system to various product inventories and pricing structures, contributing to a better user experience .

Requiring manual entry of both item names and prices can slow down operations due to the time taken for inputs and increase the risk of input errors, such as typos or mispricing. While this approach offers flexibility, it also necessitates careful management and checking to ensure data accuracy and operational efficiency .

The system uses a tuple to store item names to ensure data immutability, enhancing the integrity of item identifiers once they have been input. The advantage of this choice is that it prevents accidental modifications to the item list, which is critical for maintaining consistency during operations such as billing calculation and cart management .

The system uses lists to track both the items selected and their quantities. By appending item indices to a cart list and corresponding quantities to a separate list, the program can accurately calculate the total cost for multiples of any selected item. This separation of indices and quantities into parallel lists ensures each purchase is tallied correctly in the bill .

You might also like