Question 24d: Dict

Supermarket Billing System

You are building a mini supermarket checkout system where a cashier scans items, updates quantities, applies discounts, and prints a receipt.


🧾 Task Instructions
🔹 Step 1: Create Shopping Cart
  1. Ask the cashier:

    Enter number of items customer is buying:
    
  2. Use a loop (for with range) to collect items.

For each item:

  • Ask for:

    • Item name

    • Quantity

  • Store each item in the cart list

  • If quantity is more than 5, insert the new item at the beginning of the cart

  • Otherwise, append it to the end


🔹 Step 2: Create Price Database (Dictionary)
  1. Create an empty dictionary

  2. Loop through the cart list:

    • Ask for price of each item

    • Store like:

      {"Rice": 1200}
      
  3. If price is divisible by 10 

    • Apply 5% discount on the item price


🔹 Step 3: Update Item name, quantity and Pricebook (Modify Items)
  1. Ask:

    Do you want to update any item? (yes/no)
    
  2. If yes:

    • Display items

    • Ask for item number

    • Ask for new quantity

    • Update the items


🔹 Step 4: Calculate Total Bill
  1. Loop through the cart

  2. Multiply:

    quantity × price
    
  3. Store totals


🔹 Step 5: Print Receipt

Display:

Item     Qty     Price     Total
--------------------------------
Rice     2       1200      2400
Beans    1       800       800
--------------------------------
Grand Total: ₦3200

 

Write what you are looking for, and press enter to begin your search!