# P13.1 Python Project 1: Shopping Bill Calculator

Source: https://ravindrabagale.com/mr/datascience/py13-python-mini-projects-for-beginners-practice-before-pandas/p13-1-python-project-1-shopping-bill-calculator.html
Language: mr (Marathi with English technical terms)

हे का शिकायचं?

Lists, dictionaries, loops आणि f-strings एकत्र वापरायचा सगळ्यात सोपा project.

हे काय आहे?

Cart मधल्या प्रत्येक item ची line total काढू, subtotal, GST आणि final bill छान format मध्ये छापू.

कसं करायचं?

Step 1. Cart list of dictionaries बनवा.
Step 2. प्रत्येक line total काढा.
Step 3. GST जोडून bill छापा.

उदाहरण A: Step 1: cart आणि line totals

```python
cart = [
    {"item": "Rice 5kg", "qty": 1, "price": 425},
    {"item": "Milk 1L", "qty": 4, "price": 56},
    {"item": "Biscuits", "qty": 3, "price": 30},
]
def line_total(row):
    return row["qty"] * row["price"]
for row in cart:
    print(row["item"], line_total(row))
```

Output:

```text
Rice 5kg 425
Milk 1L 224
Biscuits 90
```

याचा अर्थ: प्रत्येक item साठी qty × price मिळाली.

उदाहरण B: Step 2: GST सह पूर्ण bill

```python
cart = [
    {"item": "Rice 5kg", "qty": 1, "price": 425},
    {"item": "Milk 1L", "qty": 4, "price": 56},
    {"item": "Biscuits", "qty": 3, "price": 30},
]
def line_total(row):
    return row["qty"] * row["price"]
subtotal = 0
for row in cart:
    t = line_total(row)
    subtotal += t
    print(f"{row['item']:<12} {row['qty']:>3} x {row['price']:>5} = ₹{t:>7,.2f}")
gst = subtotal * 0.05
print("-" * 36)
print(f"{'Subtotal':<26} ₹{subtotal:>7,.2f}")
print(f"{'GST 5%':<26} ₹{gst:>7,.2f}")
print(f"{'Total':<26} ₹{subtotal + gst:>7,.2f}")
```

Output:

```text
Rice 5kg       1 x   425 = ₹ 425.00
Milk 1L        4 x    56 = ₹ 224.00
Biscuits       3 x    30 = ₹  90.00
------------------------------------
Subtotal                   ₹ 739.00
GST 5%                     ₹  36.95
Total                      ₹ 775.95
```

याचा अर्थ: Subtotal, GST आणि total f-strings ने नीट छापले.

रवींद्र बागले यांची tip

Projects छोट्या पायऱ्यांत बनवा. Step 1 चालवून print करा, मगच step 2 जोडा.
