Spaces:
Sleeping
Sleeping
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 = [] | |