Spaces:
Running
Running
File size: 316 Bytes
b65065d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
cart = []
def add_to_cart(name, price):
global cart
cart.append({"Name": name, "Price": price, "Quantity": 1})
return cart
def view_cart():
global cart
total = sum(float(item["Price"]) * item["Quantity"] for item in cart)
return cart, total
def clear_cart():
global cart
cart = []
|