Beginner Codes/Python/Shopping Cart Program
27%

Instructions

Syntax

foods.append("Pizza") for price in prices:

Shopping Cart Program 🛒

E-commerce websites-la (Amazon, Flipkart) namba porutkala cart-la add panrappo, adhu oru 'List'-kulla thaan poi ukkarum!

Indha lesson-la namba rendu list create panna porom:

  • foods: Item names-a store panna.
  • prices: Adhoda vilaiya store panna.

Apram oru for loop use panni, motha vilaiya (total price) calculate panna porom!

1. List-la Item-a add panradhu (append) ➕

List-la pudhusa oru item add panna .append() use pannuvom.

foods = []
prices = []

foods.append('Pizza')
prices.append(250)

2. Total calculate panradhu 🧮

Cart-la ulla ella prices-ayum add panni total kandupudikkalam.

total = 0
for price in prices:
    total = total + price
print(f"Total bill: Rs.{total}")

Interactive Shopping Cart 🛍️

Kizhe ulla interactive cart-la items add panni, 'Start Checkout Loop' click panni paarunga. Python eppadi list-la irundhu ovvoru price-a eduthu total calculate pannudhu nu puriyum!

Shopping Cart Visualizer

foods =[empty]
prices =[empty]
total = 0
for price in prices:
total = total + price
print(f"Total: Rs.0")
Click the '+' buttons to append items and prices to our lists!

Available Items

Your Cart0 items

Cart is empty

Your Turn! (Unga neram!)

Kizhe ulla editor-la code-a complete pannunga.

  1. prices list-la ulla ella prices-kum for loop ezhudhunga.
  2. total variable kooda andha price-a add pannunga.
  3. Loop mudinjadhum total-a print pannunga.

Help

Shopping Cart ProgramExercise 22/7735 XP
❴❵ script.py
python.code
python
Loading...
Terminal
Terminal — python
Beginner Codes Terminal v1.0.0
─────────────────────────────────────
Ready. Click "Run Code" to execute...
Ready
Piston APIPYTHON0 lines