Python shopping cart program 🛒
Bro Code
•
November 8, 2022
Bro Code
View ChannelAbout
Coding bootcamps HATE HIM! 🗿
Latest Posts
Video Description
#python #tutorial #course # Shopping cart exercise foods = [] prices = [] total = 0 while True: food = input("Enter a food to buy (q to quit): ") if food.lower() == "q": break else: price = float(input(f"Enter the price of a {food}: $")) foods.append(food) prices.append(price) print("----- YOUR CART -----") for food in foods: print(food, end=" ") for price in prices: total += price print() print(f"Your total is: ${total}")
Boost Your Coding Skills
AI-recommended products based on this video
Loading...

Freenove Ultimate Starter Kit for BBC micro bit (V2 Included), 316-Page Detailed Tutorial, 225 Items, 44 Projects, Blocks and Python Code
(382)
$94.95
PrimeFREE delivery Sat, Jun 14
Loading...

Freenove Ultimate Starter Kit for BBC micro bit (V2 Included), 316-Page Detailed Tutorial, 225 Items, 44 Projects, Blocks and Python Code
(382)
$94.95
PrimeFREE delivery Sat, Jun 14
Loading...

Freenove Ultimate Starter Kit for BBC micro bit (V2 Included), 316-Page Detailed Tutorial, 225 Items, 44 Projects, Blocks and Python Code
(382)
$94.95
PrimeFREE delivery Sat, Jun 14
